Merge pull request #22 from nyalldawson/no_crash

Don't crash when a table can't be read for some reason
This commit is contained in:
Evan Miller 2020-08-18 21:10:52 -04:00 committed by GitHub
commit 008b3b462b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1334,9 +1334,14 @@ SQLRETURN SQL_API SQLColumns(
for (i=0; i<mdb->num_catalog; i++) {
entry = g_ptr_array_index(mdb->catalog, i);
/* TODO: Do more advanced matching */
if (g_ascii_strcasecmp((char*)szTableName, entry->object_name) != 0)
if (entry->object_type != MDB_TABLE || g_ascii_strcasecmp((char*)szTableName, entry->object_name) != 0)
continue;
table = mdb_read_table(entry);
if ( !table )
{
LogError ("Could not read table '%s'", szTableName);
return SQL_ERROR;
}
mdb_read_columns(table);
for (j=0; j<table->num_cols; j++) {
col = g_ptr_array_index(table->columns, j);