Lua themes with no options wouldn't load anymore (got broken in b4939… (#5351)

* Lua themes with no options wouldn't load anymore (got broken in b493973d7d)

* Keep protection

* Changes according to PR comments
This commit is contained in:
Andre Bernet
2017-11-18 11:59:59 +01:00
committed by Bertrand Songis
parent f7828ad4a3
commit 7f4daf3f5b
+6 -3
View File
@@ -234,8 +234,12 @@ void luaLoadThemeCallback()
} }
if (name) { if (name) {
ZoneOption * options = createOptionsArray(themeOptions, MAX_THEME_OPTIONS); ZoneOption * options = NULL;
if (options) { if (themeOptions) {
options = createOptionsArray(themeOptions, MAX_THEME_OPTIONS);
if (!options)
return;
}
LuaTheme * theme = new LuaTheme(name, options); LuaTheme * theme = new LuaTheme(name, options);
theme->loadFunction = loadFunction; theme->loadFunction = loadFunction;
theme->drawBackgroundFunction = drawBackgroundFunction; theme->drawBackgroundFunction = drawBackgroundFunction;
@@ -243,7 +247,6 @@ void luaLoadThemeCallback()
TRACE("Loaded Lua theme %s", name); TRACE("Loaded Lua theme %s", name);
} }
} }
}
class LuaWidget: public Widget class LuaWidget: public Widget
{ {