From c85fe382d67dc664a0675edb601d377364a4e740 Mon Sep 17 00:00:00 2001 From: FrainL Date: Mon, 30 May 2016 22:54:15 +0800 Subject: [PATCH] prevent from crash when lastInsertRowId is negative --- SQLite/Core/Connection.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQLite/Core/Connection.swift b/SQLite/Core/Connection.swift index f4be7983..85817025 100644 --- a/SQLite/Core/Connection.swift +++ b/SQLite/Core/Connection.swift @@ -107,7 +107,7 @@ public final class Connection { /// The last rowid inserted into the database via this connection. public var lastInsertRowid: Int64? { let rowid = sqlite3_last_insert_rowid(handle) - return rowid > 0 ? rowid : nil + return rowid != 0 ? rowid : nil } /// The last number of changes (inserts, updates, or deletes) made to the