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>
(cherry-picked from commit e82d811ab0
)
This commit is contained in:
parent
e59a50b2f5
commit
c1319349b3
2 changed files with 9 additions and 1 deletions
|
@ -162,6 +162,8 @@
|
|||
(issue #3050).
|
||||
* Fixed a crash when using certain invalid color= values.
|
||||
* 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.13.12
|
||||
### Security fixes
|
||||
|
|
|
@ -920,7 +920,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