Skip to content

Commit

Permalink
Don't override the FGIMG style property if the image parameter is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Df458 authored and sfan5 committed Dec 16, 2019
1 parent e42faae commit b50dc43
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/gui/guiFormSpecMenu.cpp
Expand Up @@ -1835,9 +1835,6 @@ void GUIFormSpecMenu::parseImageButton(parserData* data, const std::string &elem
if (type == "image_button_exit")
spec.is_exit = true;

video::ITexture *texture = 0;
texture = m_tsrc->getTexture(image_name);

GUIButtonImage *e = GUIButtonImage::addButton(Environment, rect, this, spec.fid, spec.flabel.c_str());

if (spec.fname == data->focused_fieldname) {
Expand All @@ -1849,8 +1846,12 @@ void GUIFormSpecMenu::parseImageButton(parserData* data, const std::string &elem

// We explicitly handle these arguments *after* the style properties in
// order to override them if they are provided
e->setForegroundImage(guiScalingImageButton(
Environment->getVideoDriver(), texture, geom.X, geom.Y));
if (!image_name.empty())
{
video::ITexture *texture = m_tsrc->getTexture(image_name);
e->setForegroundImage(guiScalingImageButton(
Environment->getVideoDriver(), texture, geom.X, geom.Y));
}
if (!pressed_image_name.empty()) {
video::ITexture *pressed_texture = m_tsrc->getTexture(pressed_image_name);
e->setPressedForegroundImage(guiScalingImageButton(
Expand Down

0 comments on commit b50dc43

Please sign in to comment.