diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-11 01:16:22 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-11 01:16:22 +0200 |
commit | b9516ad7cb6372638c10848cf87fceea5c5fa3e7 (patch) | |
tree | 2a0641e3c8e2ec691760aca4c0f82f6d620021aa /src/gui | |
parent | c030596364968f86f88546d3890e5b45929db47a (diff) | |
download | manaplus-b9516ad7cb6372638c10848cf87fceea5c5fa3e7.tar.gz manaplus-b9516ad7cb6372638c10848cf87fceea5c5fa3e7.tar.bz2 manaplus-b9516ad7cb6372638c10848cf87fceea5c5fa3e7.tar.xz manaplus-b9516ad7cb6372638c10848cf87fceea5c5fa3e7.zip |
Add checks to tabbedarea.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index e0bf9e12f..ca3eb5095 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -244,10 +244,11 @@ void TabbedArea::widgetResized(const gcn::Event &event _UNUSED_) void TabbedArea::updateTabsWidth() { mTabsWidth = 0; - for (TabContainer::const_iterator itr = mTabs.begin(), itr_end = mTabs.end(); - itr != itr_end; ++itr) + for (TabContainer::const_iterator itr = mTabs.begin(), + itr_end = mTabs.end(); itr != itr_end; ++itr) { - mTabsWidth += (*itr).first->getWidth(); + if ((*itr).first) + mTabsWidth += (*itr).first->getWidth(); } updateVisibleTabsWidth(); } @@ -257,7 +258,8 @@ void TabbedArea::updateVisibleTabsWidth() mVisibleTabsWidth = 0; for (unsigned int i = mTabScrollIndex; i < mTabs.size(); ++i) { - mVisibleTabsWidth += mTabs[i].first->getWidth(); + if (mTabs[i].first) + mVisibleTabsWidth += mTabs[i].first->getWidth(); } } @@ -266,16 +268,16 @@ void TabbedArea::adjustTabPositions() int maxTabHeight = 0; for (unsigned i = 0; i < mTabs.size(); ++i) { - if (mTabs[i].first->getHeight() > maxTabHeight) - { + if (mTabs[i].first && mTabs[i].first->getHeight() > maxTabHeight) maxTabHeight = mTabs[i].first->getHeight(); - } } int x = mArrowButton[0]->isVisible() ? mArrowButton[0]->getWidth() : 0; for (unsigned i = mTabScrollIndex; i < mTabs.size(); ++i) { gcn::Tab* tab = mTabs[i].first; + if (!tab) + continue; tab->setPosition(x, maxTabHeight - tab->getHeight()); x += tab->getWidth(); } @@ -287,8 +289,11 @@ void TabbedArea::adjustTabPositions() for (unsigned i = 0; i < mTabScrollIndex; ++i) { gcn::Tab* tab = mTabs[i].first; - x -= tab->getWidth(); - tab->setPosition(x, maxTabHeight - tab->getHeight()); + if (tab) + { + x -= tab->getWidth(); + tab->setPosition(x, maxTabHeight - tab->getHeight()); + } } } } |