diff --git a/changelog b/changelog index 14e141cd788..ae9d525fc37 100644 --- a/changelog +++ b/changelog @@ -3,6 +3,8 @@ Version 1.7.2+svn: * New unit graphics and animations for the Troll Hero. * Language and i18n: * Updated translations: Dutch, French + * WML Engine: + * return 0 for length of arrays inside nonexistent containers (bug #13734) * Miscellaneous and bugfixes: * 'Recruit' and 'recall' don't appear in context menus unless the leader is on a keep. (bug #13856 and #13855) diff --git a/src/gamestatus.cpp b/src/gamestatus.cpp index 914a9556872..32f842f08c9 100644 --- a/src/gamestatus.cpp +++ b/src/gamestatus.cpp @@ -532,7 +532,14 @@ t_string& game_state::get_variable(const std::string& key) const t_string& game_state::get_variable_const(const std::string& key) const { variable_info to_get(key, false, variable_info::TYPE_SCALAR); - if(!to_get.is_valid) return temporaries[key]; + if(!to_get.is_valid) { + t_string& to_return = temporaries[key]; + if(key.size() > 7 and key.substr(key.size()-7)==".length") { + // length is a special attribute, so guarantee its correctness + to_return = "0"; + } + return to_return; + } return to_get.as_scalar(); }