]> git.sesse.net Git - pkanalytics/commitdiff
Fix crash if there are no matches (database is empty).
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 26 Jul 2023 22:17:38 +0000 (00:17 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 26 Jul 2023 22:17:38 +0000 (00:17 +0200)
main.cpp

index e233c08c30f7a305c00f752455a6e7e7be457cfd..ade653a72b4e1f1cdd31aac389ece506a1a12953 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -96,7 +96,9 @@ int get_match_id(sqlite3 *db, QWidget *parent, int requested_match)
                dialog.setWindowTitle("Open game");
                dialog.setLabelText("Choose game to analyze:");
                dialog.setComboBoxItems(items);
-               dialog.setTextValue(items[items.size() - 2]);
+               if (items.size() >= 2) {
+                       dialog.setTextValue(items[items.size() - 2]);
+               }
                dialog.setOption(QInputDialog::UseListViewForComboBoxItems, true);
                if (!dialog.exec()) {
                        return -1;