Skip to content

Commit 796d042

Browse files
committed
fix: NULL x string comparison crash
1 parent 11ec70b commit 796d042

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

package/cpp/types.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ struct SQLiteExecuteQueryResult {
3232
};
3333

3434
// constexpr function that maps SQLiteColumnType to string literals
35-
constexpr ColumnType mapSQLiteTypeToColumnType(std::string type) {
36-
if (type == "BOOLEAN") {
35+
constexpr ColumnType mapSQLiteTypeToColumnType(const char* type) {
36+
if (type == NULL) {
37+
return ColumnType::NULL_VALUE;
38+
} else if (*type == "BOOLEAN") {
3739
return ColumnType::BOOLEAN;
38-
} else if (type == "FLOAT") {
40+
} else if (*type == "FLOAT") {
3941
return ColumnType::NUMBER;
40-
} else if (type == "INTEGER") {
42+
} else if (*type == "INTEGER") {
4143
return ColumnType::INT64;
42-
} else if (type == "TEXT") {
44+
} else if (*type == "TEXT") {
4345
return ColumnType::TEXT;
44-
} else if (type == "BLOB") {
46+
} else if (*type == "BLOB") {
4547
return ColumnType::ARRAY_BUFFER;
4648
} else {
4749
return ColumnType::NULL_VALUE;

0 commit comments

Comments
 (0)