Line 55 is the call to register the function with SQLite. Off the top of my head, I'm not sure what would be crashing there. There is no check about whether the PSqlite3 object is valid. That is supplied by SQLite, but I suppose we should be checking its validity.
Independent of this, I did just post a more cleaned up version of this on Github as nim-sqliteext, [https://github.com/chrisheller/nim-sqliteext](https://github.com/chrisheller/nim-sqliteext). That uses some macro code to inspect a Nim proc and setup the glue code so that your function can be more Nim focused. It is very basic at this point though (only SQLite functions, no virtual tables, etc, only string/number for type mapping). I'd be curious if you get the same error with that code.