diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-03 23:51:01 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-03 23:51:01 +0100 |
commit | f9cb8f4bab6ab4552b6197d433a267cb4b7941b0 (patch) | |
tree | 71465c24a1e0546ea5bb810c8aa58ccf783e9fca /src/gui/setup.cpp | |
parent | 0f2eef4278b258bb59968686b48f7de0ecd923e3 (diff) | |
download | mana-f9cb8f4bab6ab4552b6197d433a267cb4b7941b0.tar.gz mana-f9cb8f4bab6ab4552b6197d433a267cb4b7941b0.tar.bz2 mana-f9cb8f4bab6ab4552b6197d433a267cb4b7941b0.tar.xz mana-f9cb8f4bab6ab4552b6197d433a267cb4b7941b0.zip |
Disabled "Reset Windows" button when appropriate
You shouldn't be able to press "Reset Windows" before the in-game
windows have been created. Previously this would crash.
Diffstat (limited to 'src/gui/setup.cpp')
-rw-r--r-- | src/gui/setup.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 6be0399c..4fae514f 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -59,6 +59,10 @@ Setup::Setup(): x -= btn->getWidth() + 5; btn->setPosition(x, height - btn->getHeight() - 5); add(btn); + + // Disable this button when the windows aren't created yet + if (!strcmp(*curBtn, "Reset Windows")) + btn->setEnabled(statusWindow != NULL); } TabbedContainer *panel = new TabbedContainer(); @@ -111,6 +115,11 @@ void Setup::action(const gcn::ActionEvent &event) } else if (event.getId() == "Reset Windows") { + // Bail out if this action happens to be activated before the windows + // are created (though it should be disabled then) + if (!statusWindow) + return; + statusWindow->resetToDefaultSize(); minimap->resetToDefaultSize(); chatWindow->resetToDefaultSize(); |