diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2008-04-17 21:02:15 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2008-04-17 21:02:15 +0000 |
commit | 0b567928c0a24c7346451b59285ce8144ae0bf2e (patch) | |
tree | b878bf03f17b2a83d2e5652460a03f24d6b386a8 /src | |
parent | f43ce278866a2c42f67f75972c2e4abe46f8fd82 (diff) | |
download | mana-0b567928c0a24c7346451b59285ce8144ae0bf2e.tar.gz mana-0b567928c0a24c7346451b59285ce8144ae0bf2e.tar.bz2 mana-0b567928c0a24c7346451b59285ce8144ae0bf2e.tar.xz mana-0b567928c0a24c7346451b59285ce8144ae0bf2e.zip |
Fixed a crash when clicking on 'Quit Guild' Button. Also disabled the 'Invite user'
and 'Quit Guild' buttons when no Guild is created.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/guildwindow.cpp | 17 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 1 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp index 0e9a066a..2a4de773 100644 --- a/src/gui/guildwindow.cpp +++ b/src/gui/guildwindow.cpp @@ -85,6 +85,12 @@ GuildWindow::~GuildWindow() void GuildWindow::update() { updateTab(); + + if (mGuildButton[2]->isEnabled()&& mGuildTabs->getNumberOfTabs() <= 0) + { + mGuildButton[2]->setEnabled(false); + mGuildButton[1]->setEnabled(false); + } } void GuildWindow::draw(gcn::Graphics *g) @@ -217,10 +223,15 @@ bool GuildWindow::isFocused() short GuildWindow::getSelectedGuild() { - Guild *guild = player_node->getGuild(mGuildTabs->getSelectedTab()->getCaption()); - if (guild) + if (mGuildTabs->getNumberOfTabs() > 0) { - return guild->getId(); + + Guild *guild = player_node->getGuild(mGuildTabs->getSelectedTab()->getCaption()); + + if (guild) + { + return guild->getId(); + } } return 0; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index a22c795c..9087babc 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -47,6 +47,7 @@ gcn::Tab* TabbedArea::getTab(const std::string &name) } ++itr; } + return NULL; } void TabbedArea::draw(gcn::Graphics *graphics) |