mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
LibSQL: Do not crash when SELECTing from an empty table
The crash was caused by getting the first element of an empty vector.
This commit is contained in:
parent
373b467302
commit
f1f0770d68
2 changed files with 13 additions and 2 deletions
|
@ -69,8 +69,8 @@ Result Select::execute(ExecutionContext& context) const
|
|||
auto old_descriptor_size = descriptor->size();
|
||||
descriptor->extend(table_def->to_tuple_descriptor());
|
||||
|
||||
for (auto cartesian_row = rows.first(); cartesian_row.size() == old_descriptor_size; cartesian_row = rows.first()) {
|
||||
rows.remove(0);
|
||||
while (!rows.is_empty() && (rows.first().size() == old_descriptor_size)) {
|
||||
auto cartesian_row = rows.take_first();
|
||||
auto table_rows = TRY(context.database->select_all(*table_def));
|
||||
|
||||
for (auto& table_row : table_rows) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue