From b96e34946aa326a9f8dfb80ce34cce9fc219405e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 2 Apr 2011 01:23:15 +0300 Subject: Add missing checks. --- src/gui/theme.cpp | 7 +++++-- src/gui/widgets/popup.cpp | 21 ++++++++++++++++++--- src/gui/widgets/scrollarea.cpp | 3 ++- src/gui/widgets/tab.cpp | 3 +++ src/gui/widgets/window.cpp | 21 ++++++++++++++++++--- 5 files changed, 46 insertions(+), 9 deletions(-) (limited to 'src') 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(minimumOpacityAllowed), static_cast(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) -- cgit v1.2.3-60-g2f50