Skip to content

Commit

Permalink
Check for nullptr instead of NULL on preparedstatementhostobject
Browse files Browse the repository at this point in the history
  • Loading branch information
ospfranco committed Mar 11, 2024
1 parent d9bee65 commit 9ef36c6
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions cpp/PreparedStatementHostObject.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
//
// PreparedStatementHostObject.cpp
// op-sqlite
//
// Created by Oscar Franco on 5/12/23.
//

#include "PreparedStatementHostObject.h"
#include "bridge.h"
#include "macros.h"
Expand All @@ -31,7 +24,7 @@ jsi::Value PreparedStatementHostObject::get(jsi::Runtime &rt,

if (name == "bind") {
return HOSTFN("bind", 1) {
if (_statement == NULL) {
if (_statement == nullptr) {
throw std::runtime_error("statement has been freed");
}

Expand All @@ -46,7 +39,7 @@ jsi::Value PreparedStatementHostObject::get(jsi::Runtime &rt,

if (name == "execute") {
return HOSTFN("execute", 1) {
if (_statement == NULL) {
if (_statement == nullptr) {
throw std::runtime_error("statement has been freed");
}
std::vector<DumbHostObject> results;
Expand All @@ -69,9 +62,9 @@ jsi::Value PreparedStatementHostObject::get(jsi::Runtime &rt,
}

PreparedStatementHostObject::~PreparedStatementHostObject() {
if (_statement != NULL) {
if (_statement != nullptr) {
sqlite3_finalize(_statement);
_statement = NULL;
_statement = nullptr;
}
}

Expand Down

0 comments on commit 9ef36c6

Please sign in to comment.