Check that db.prepare worked before using the returned statement

This commit is contained in:
louiz’
2018-03-23 15:54:36 +01:00
parent faa33c1a71
commit cdace80758
+2
View File
@@ -115,6 +115,8 @@ struct SelectQuery: public Query
#endif #endif
auto statement = db.prepare(this->body); auto statement = db.prepare(this->body);
if (!statement)
return rows;
statement->bind(std::move(this->params)); statement->bind(std::move(this->params));
while (statement->step() == StepResult::Row) while (statement->step() == StepResult::Row)