From 036e4349e0866f6172e2203ddf185404ab8f3887 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Tue, 31 Jan 2017 18:56:42 +0100 Subject: [PATCH] Fix crash when clicking Create Index in empty database 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. --- src/EditIndexDialog.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/EditIndexDialog.cpp b/src/EditIndexDialog.cpp index f63c48e1..69ae484d 100644 --- a/src/EditIndexDialog.cpp +++ b/src/EditIndexDialog.cpp @@ -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()->fieldNames(); ui->tableIndexColumns->setRowCount(fields.size());