lib/sqlite3: protect close statements
authorAlexis Laferrière <alexis.laf@xymus.net>
Fri, 8 Apr 2016 12:50:31 +0000 (08:50 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Fri, 8 Apr 2016 15:38:08 +0000 (11:38 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/sqlite3/sqlite3.nit

index 65eb0b7..e5695af 100644 (file)
@@ -42,6 +42,8 @@ class Sqlite3DB
        # Close this connection to the DB and all open statements
        fun close
        do
        # Close this connection to the DB and all open statements
        fun close
        do
+               if not is_open then return
+
                is_open = false
 
                # close open statements
                is_open = false
 
                # close open statements
@@ -120,6 +122,8 @@ class Statement
        # Close and finalize this statement
        fun close
        do
        # Close and finalize this statement
        fun close
        do
+               if not is_open then return
+
                is_open = false
                native_statement.finalize
        end
                is_open = false
                native_statement.finalize
        end