diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-02 01:23:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-02 01:23:15 +0300 |
commit | b96e34946aa326a9f8dfb80ce34cce9fc219405e (patch) | |
tree | 964b4d36e8a018c0c656b9d52a291202c7dc6704 | |
parent | 91737976634821cef7d1e373ac8bf7a7b2e95a69 (diff) | |
download | manaplus-b96e34946aa326a9f8dfb80ce34cce9fc219405e.tar.gz manaplus-b96e34946aa326a9f8dfb80ce34cce9fc219405e.tar.bz2 manaplus-b96e34946aa326a9f8dfb80ce34cce9fc219405e.tar.xz manaplus-b96e34946aa326a9f8dfb80ce34cce9fc219405e.zip |
Add missing checks.
-rw-r--r-- | src/gui/theme.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/popup.cpp | 21 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/tab.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 21 |
5 files changed, 46 insertions, 9 deletions
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 8aab63728..98251948f 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -99,8 +99,11 @@ void Skin::updateAlpha(float minimumOpacityAllowed) std::max(static_cast<double>(minimumOpacityAllowed), static_cast<double>(Client::getGuiAlpha()))); - for_each(mBorder.grid, mBorder.grid + 9, - std::bind2nd(std::mem_fun(&Image::setAlpha), alpha)); + for (int i = 0; i < 9; i++) + { + if (mBorder.grid[i]) + mBorder.grid[i]->setAlpha(alpha); + } if (mCloseImage) mCloseImage->setAlpha(alpha); diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 7519d1583..bc15a4c2c 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -142,13 +142,28 @@ void Popup::setLocationRelativeTo(gcn::Widget *widget) void Popup::setMinWidth(int width) { - mMinWidth = width > mSkin->getMinWidth() ? width : mSkin->getMinWidth(); + if (mSkin) + { + mMinWidth = width > mSkin->getMinWidth() + ? width : mSkin->getMinWidth(); + } + else + { + mMinWidth = width; + } } void Popup::setMinHeight(int height) { - mMinHeight = height > mSkin->getMinHeight() ? - height : mSkin->getMinHeight(); + if (mSkin) + { + mMinHeight = height > mSkin->getMinHeight() ? + height : mSkin->getMinHeight(); + } + else + { + mMinHeight = height; + } } void Popup::setMaxWidth(int width) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index a78048314..0be492ee6 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -148,7 +148,8 @@ void ScrollArea::init() } } - textbox->decRef(); + if (textbox) + textbox->decRef(); // Load vertical scrollbar skin Image *vscroll = Theme::getImageFromTheme("vscroll_grey.png"); diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 6750ffbbc..73ffff30e 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -108,6 +108,9 @@ void Tab::init() for (mode = 0; mode < TAB_COUNT; mode++) { tab[mode] = Theme::getImageFromTheme(data[mode].file); + if (!tab[mode]) + continue; + a = 0; for (y = 0; y < 3; y++) { diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 3531ac245..14f39a4c3 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -273,13 +273,28 @@ void Window::setLocationRelativeTo(ImageRect::ImagePosition position, void Window::setMinWidth(int width) { - mMinWinWidth = width > mSkin->getMinWidth() ? width : mSkin->getMinWidth(); + if (mSkin) + { + mMinWinWidth = width > mSkin->getMinWidth() + ? width : mSkin->getMinWidth(); + } + else + { + mMinWinWidth = width; + } } void Window::setMinHeight(int height) { - mMinWinHeight = height > mSkin->getMinHeight() ? - height : mSkin->getMinHeight(); + if (mSkin) + { + mMinWinHeight = height > mSkin->getMinHeight() ? + height : mSkin->getMinHeight(); + } + else + { + mMinWinHeight = height; + } } void Window::setMaxWidth(int width) |