Skip to content

Commit e2bd1a2

Browse files
authored
Merge pull request #332 from OP-Engineering/oscar/fix-reactive-null-ptr
Prevent firing reactive query if value has been cleared by JS
2 parents 2173e26 + 856cecd commit e2bd1a2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cpp/DBHostObject.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ void DBHostObject::on_update(const std::string &table,
8383

8484
for (const auto &query_ptr : reactive_queries) {
8585
auto query = query_ptr.get();
86+
87+
// The JS environment might have cleared the query while the update was queued
88+
// For now this seems to prevent a EXC_BAD_ACCESS
89+
if (query == nullptr) {
90+
continue;
91+
}
92+
93+
8694
if (query->discriminators.empty()) {
8795
continue;
8896
}

0 commit comments

Comments
 (0)