mirror of
https://github.com/logos-storage/nim-datastore.git
synced 2026-01-07 16:13:07 +00:00
Cast to nil value because nil cannot be applied directly to distinct pointer
Signed-off-by: Arnaud <arnaud@status.im>
This commit is contained in:
parent
c2314f21fd
commit
7e053e5e0d
@ -128,7 +128,11 @@ template dispose*(db: SQLite) =
|
||||
|
||||
template dispose*(sqliteStmt: SQLiteStmt) =
|
||||
doAssert SQLITE_OK == sqlite3_finalize(RawStmtPtr(sqliteStmt))
|
||||
sqliteStmt = nil
|
||||
# nil literals can no longer be directly assigned to variables or fields of distinct pointer types.
|
||||
# They must be converted instead.
|
||||
# See https://nim-lang.org/blog/2022/12/21/version-20-rc.html#:~:text=nil%20literals%20can%20no%20longer%20be%20directly%20assigned%20to%20variables%20or%20fields%20of%20distinct%20pointer%20types.%20They%20must%20be%20converted%20instead.
|
||||
# SQLiteStmt(nil) is generating a SIGSEGV, so we need to cast it
|
||||
sqliteStmt = cast[typeof sqliteStmt](nil)
|
||||
|
||||
proc release*[T](x: var AutoDisposed[T]): T =
|
||||
result = x.val
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user