Fix [change_theme] crashing when theme= isn't specified
Leaving theme= unspecified ought to have the same effect as providing it and setting it to an empty string. Without the check for a nil value, however, it would result in a crash like this: 20180519 22:31:54 error scripting/lua: lua/wml-tags.lua:922: bad argument #3 to '__newindex' (string expected, got nil) stack traceback: [C]: in metamethod '__newindex' lua/wml-tags.lua:922: in local 'cmd' lua/wml-utils.lua:145: in field 'handle_event_commands' lua/wml-flow.lua:6: in function <lua/wml-flow.lua:5>
This commit is contained in:
parent
491605dc97
commit
a58712a539
2 changed files with 9 additions and 1 deletions
|
@ -8,6 +8,8 @@
|
|||
* Fixed MP lobby player list scrolling to top when it changes
|
||||
### Miscellaneous and bug fixes
|
||||
* Fixed: unit halo remained after undoing a recall (issue #3065)
|
||||
* [change_theme] no longer causes a Lua error when theme= is not specified
|
||||
instead of explicitly set to an empty string.
|
||||
|
||||
## Version 1.14.1
|
||||
### Campaigns
|
||||
|
|
|
@ -913,7 +913,13 @@ function wml_actions.reset_fog(cfg)
|
|||
end
|
||||
|
||||
function wesnoth.wml_actions.change_theme(cfg)
|
||||
wesnoth.game_config.theme = cfg.theme
|
||||
local new_theme = cfg.theme
|
||||
|
||||
if new_theme == nil then
|
||||
new_theme = ""
|
||||
end
|
||||
|
||||
wesnoth.game_config.theme = new_theme
|
||||
end
|
||||
|
||||
function wesnoth.wml_actions.zoom(cfg)
|
||||
|
|
Loading…
Add table
Reference in a new issue