Bugfix (segfault when starting a game after finishing all levels). master
authorMarja Hassinen <marja2@Vahvero.(none)>
Mon, 11 Jan 2010 18:42:35 +0000 (20:42 +0200)
committerMarja Hassinen <marja2@Vahvero.(none)>
Mon, 11 Jan 2010 18:42:35 +0000 (20:42 +0200)
If none of the level collections have un-passed levels, none of them
got selected in the list widget -> trying to do something with the
current item caused a segfault.

src/game.cpp

index 41bff30..6b8aa20 100644 (file)
@@ -594,6 +594,13 @@ void LevelSwitcher::chooseLevelCollection()
             first = false;
         }
     }
+
+    if (first) {
+        // None of the rows got the focus yet; set it to the first
+        // item
+        levelList->setCurrentItem(levelList->item(0));
+    }
+
     gameWidget->hide();
     startWidget->hide();
     levelWidget->show();