From da5d52dc2746cf5ce2a6a0dcb00131da41ddb665 Mon Sep 17 00:00:00 2001 From: Josh Wittner Date: Tue, 24 Oct 2017 16:44:59 -0700 Subject: [PATCH] Use default if null object is returned --- Example/Assets/Scripts/SQLite.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Example/Assets/Scripts/SQLite.cs b/Example/Assets/Scripts/SQLite.cs index 18ce6c3..9d6f591 100644 --- a/Example/Assets/Scripts/SQLite.cs +++ b/Example/Assets/Scripts/SQLite.cs @@ -2175,7 +2175,10 @@ public T ExecuteScalar () var r = SQLite3.Step (stmt); if (r == SQLite3.Result.Row) { var colType = SQLite3.ColumnType (stmt, 0); - val = (T)ReadCol (stmt, 0, colType, typeof(T)); + object colValue = ReadCol(stmt, 0, colType, typeof(T)); + if(colValue == null) { return default(T); } + + return (T)colValue; } else if (r == SQLite3.Result.Done) { }