mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +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:
committed by
Linus Groh
parent
373b467302
commit
f1f0770d68
@@ -177,6 +177,17 @@ TEST_CASE(insert_without_column_names)
|
||||
EXPECT_EQ(rows_or_error.value().size(), 2u);
|
||||
}
|
||||
|
||||
TEST_CASE(select_from_empty_table)
|
||||
{
|
||||
ScopeGuard guard([]() { unlink(db_name); });
|
||||
auto database = SQL::Database::construct(db_name);
|
||||
EXPECT(!database->open().is_error());
|
||||
create_table(database);
|
||||
auto result = execute(database, "SELECT * FROM TestSchema.TestTable;");
|
||||
EXPECT(!result.is_error());
|
||||
EXPECT(!result.has_results());
|
||||
}
|
||||
|
||||
TEST_CASE(select_from_table)
|
||||
{
|
||||
ScopeGuard guard([]() { unlink(db_name); });
|
||||
|
||||
Reference in New Issue
Block a user