From 7f4daf3f5baba6c7c52ef6be6e9e5262acc540b6 Mon Sep 17 00:00:00 2001 From: Andre Bernet Date: Sat, 18 Nov 2017 11:59:59 +0100 Subject: [PATCH] =?UTF-8?q?Lua=20themes=20with=20no=20options=20wouldn't?= =?UTF-8?q?=20load=20anymore=20(got=20broken=20in=20b4939=E2=80=A6=20(#535?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Lua themes with no options wouldn't load anymore (got broken in b493973d7d5cb123e8b12f7e0dfd292c05f25458) * Keep protection * Changes according to PR comments --- radio/src/lua/widgets.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/radio/src/lua/widgets.cpp b/radio/src/lua/widgets.cpp index ccf2b347e..8ccc7c883 100644 --- a/radio/src/lua/widgets.cpp +++ b/radio/src/lua/widgets.cpp @@ -234,14 +234,17 @@ void luaLoadThemeCallback() } if (name) { - ZoneOption * options = createOptionsArray(themeOptions, MAX_THEME_OPTIONS); - if (options) { - LuaTheme * theme = new LuaTheme(name, options); - theme->loadFunction = loadFunction; - theme->drawBackgroundFunction = drawBackgroundFunction; - theme->drawTopbarBackgroundFunction = drawTopbarBackgroundFunction; - TRACE("Loaded Lua theme %s", name); + ZoneOption * options = NULL; + if (themeOptions) { + options = createOptionsArray(themeOptions, MAX_THEME_OPTIONS); + if (!options) + return; } + LuaTheme * theme = new LuaTheme(name, options); + theme->loadFunction = loadFunction; + theme->drawBackgroundFunction = drawBackgroundFunction; + theme->drawTopbarBackgroundFunction = drawTopbarBackgroundFunction; + TRACE("Loaded Lua theme %s", name); } }