Sorry then, I have just seen the code you posted and there was nothing about creating the database schema...
Well, perhaps better testcase would help. You are almost there (with the testcase), but you should post the whole package (whole directory, including the .upp file) and make it so that I get that crash here too, without haveing your .db file, or perhaps send .db file too.
(Sorry about being nitpick, but this should be much easier for those submiting problems than for those responding is to recreating the whole thing by guessing