mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-03-20 19:42:28 +01:00
Now get_cell and is_cell_null in Sqlite3QueryResult will do a bounds check via error macros.
This means indexing errors will not result in a crash due to vectors using CRASH_BAD_INDEX error macros.
This commit is contained in:
parent
e210e8dc0a
commit
9da9dbc14c
@ -1,6 +1,7 @@
|
|||||||
#include "sqlite3_query_result.h"
|
#include "sqlite3_query_result.h"
|
||||||
|
|
||||||
#include "./sqlite/sqlite3.h"
|
#include "./sqlite/sqlite3.h"
|
||||||
|
#include "core/error/error_macros.h"
|
||||||
#include "core/string/print_string.h"
|
#include "core/string/print_string.h"
|
||||||
#include "core/string/ustring.h"
|
#include "core/string/ustring.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -16,10 +17,16 @@ int Sqlite3QueryResult::get_stored_row_count() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String Sqlite3QueryResult::get_cell(const int index) {
|
String Sqlite3QueryResult::get_cell(const int index) {
|
||||||
|
ERR_FAIL_INDEX_V(current_row, rows.size(), String());
|
||||||
|
ERR_FAIL_INDEX_V(index, rows[current_row]->cells.size(), String());
|
||||||
|
|
||||||
return rows[current_row]->cells[index].data;
|
return rows[current_row]->cells[index].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sqlite3QueryResult::is_cell_null(const int index) {
|
bool Sqlite3QueryResult::is_cell_null(const int index) {
|
||||||
|
ERR_FAIL_INDEX_V(current_row, rows.size(), true);
|
||||||
|
ERR_FAIL_INDEX_V(index, rows[current_row]->cells.size(), true);
|
||||||
|
|
||||||
return rows[current_row]->cells[index].null;
|
return rows[current_row]->cells[index].null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user