commit b486d5e102a81e20d7717840ac4b0a326cbd7c6f
parent 881dae09548d40c03671d1a9faea87de7cd7f6a0
Author: William Casarin <jb55@jb55.com>
Date: Sun, 11 Feb 2024 08:52:29 -0800
add some more close guards
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/nostrdb/Ndb.swift b/nostrdb/Ndb.swift
@@ -349,6 +349,7 @@ class Ndb {
}
func lookup_note_key_with_txn<Y>(_ id: NoteId, txn: NdbTxn<Y>) -> NoteKey? {
+ guard !closed else { return nil }
return id.id.withUnsafeBytes { (ptr: UnsafeRawBufferPointer) -> NoteKey? in
guard let p = ptr.baseAddress else {
return nil
@@ -395,6 +396,7 @@ class Ndb {
}
func write_profile_last_fetched(pubkey: Pubkey, fetched_at: UInt64) {
+ guard !closed else { return }
let _ = pubkey.id.withUnsafeBytes { (ptr: UnsafeRawBufferPointer) -> () in
guard let p = ptr.baseAddress else { return }
ndb_write_last_profile_fetch(ndb.ndb, p, fetched_at)
@@ -402,6 +404,7 @@ class Ndb {
}
func read_profile_last_fetched<Y>(txn: NdbTxn<Y>, pubkey: Pubkey) -> UInt64? {
+ guard !closed else { return nil }
return pubkey.id.withUnsafeBytes { (ptr: UnsafeRawBufferPointer) -> UInt64? in
guard let p = ptr.baseAddress else { return nil }
let res = ndb_read_last_profile_fetch(&txn.txn, p)