Skip to content

Commit

Permalink
Fix crash when clicking Create Index in empty database
Browse files Browse the repository at this point in the history
This fixes a crash that would happen if you click the Create Index
button while having opened an empty database file, i.e. without any
table to create an index on yet.
  • Loading branch information
MKleusberg committed Jan 31, 2017
1 parent 8da6262 commit 036e434
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/EditIndexDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ void EditIndexDialog::tableChanged(const QString& new_table, bool initialLoad)
index.clearColumns();
}

// Stop here if table name is empty
if(new_table.isEmpty())
{
// Call checkInput() before to make sure the OK button is disabled
checkInput();
return;
}

// And fill the table again
QStringList fields = pdb.getObjectByName(new_table).dynamicCast<sqlb::Table>()->fieldNames();
ui->tableIndexColumns->setRowCount(fields.size());
Expand Down

0 comments on commit 036e434

Please sign in to comment.