diff options
Diffstat (limited to '')
-rw-r--r-- | gui/listbox.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gui/listbox.cpp b/gui/listbox.cpp index 05276e8ac..9d36baed7 100644 --- a/gui/listbox.cpp +++ b/gui/listbox.cpp @@ -44,8 +44,17 @@ GUIListBox::GUIListBox(xml_node<>* node) : GUIScrollList(node) mIconSelected = LoadAttrImage(child, "selected"); mIconUnselected = LoadAttrImage(child, "unselected"); } - int iconWidth = std::max(mIconSelected->GetWidth(), mIconUnselected->GetWidth()); - int iconHeight = std::max(mIconSelected->GetHeight(), mIconUnselected->GetHeight()); + int iconWidth = 0, iconHeight = 0; + if (mIconSelected && mIconSelected->GetResource() && mIconUnselected && mIconUnselected->GetResource()) { + iconWidth = std::max(mIconSelected->GetWidth(), mIconUnselected->GetWidth()); + iconHeight = std::max(mIconSelected->GetHeight(), mIconUnselected->GetHeight()); + } else if (mIconSelected && mIconSelected->GetResource()) { + iconWidth = mIconSelected->GetWidth(); + iconHeight = mIconSelected->GetHeight(); + } else if (mIconUnselected && mIconUnselected->GetResource()) { + iconWidth = mIconUnselected->GetWidth(); + iconHeight = mIconUnselected->GetHeight(); + } SetMaxIconSize(iconWidth, iconHeight); // Handle the result variable |