diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-12-03 23:51:01 +0100 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-03 17:14:40 -0700 |
commit | f71dba822f42428f22741f183df9f1132fa9471c (patch) | |
tree | bc532b3f4bfdb78c6f901e2a2d557ec084763c68 /src/gui/setup.cpp | |
parent | 778ddd361839eb9a971b99bb3d77a30e59ddc977 (diff) | |
download | mana-f71dba822f42428f22741f183df9f1132fa9471c.tar.gz mana-f71dba822f42428f22741f183df9f1132fa9471c.tar.bz2 mana-f71dba822f42428f22741f183df9f1132fa9471c.tar.xz mana-f71dba822f42428f22741f183df9f1132fa9471c.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 b8fdb7de..2c22a426 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -60,6 +60,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(width, 5, 20, 45, 5, 3); @@ -116,6 +120,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(); |