Skip to content

Commit

Permalink
addon/mg: Ensure _info.cfg has an [info] node when reading it
Browse files Browse the repository at this point in the history
Fixes the dreaded "Mandatory WML child missing yet untested for. Please
report" error occurring when reading _info.cfg files that don't have a
valid [info] tag. In particular, this would cause the game version
dialog to crash to desktop.
  • Loading branch information
irydacea committed Dec 10, 2020
1 parent d8f9436 commit 220792d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog.md
Expand Up @@ -3,6 +3,8 @@
* Fixed inability to write files (including the server configuration file) on Windows.
* Dropped plain text passphrase migration, unused in production since version 1.12.7 and 1.13.0 (issue #5080).
* Uploading add-ons with versions not greater than the latest uploaded version is no longer allowed (issue #5079).
### Add-ons client
* Fix potential crashes when working with installed add-ons that have a corrupted _info.cfg file.
### Campaigns
### Multiplayer
* Added `/roll N` command to multiplayer games and game lobbies which produces a publicly visible random integer number ranged from 1 to N inclusively (issue #5221, PR #5326).
Expand Down
2 changes: 1 addition & 1 deletion src/addon/manager.cpp
Expand Up @@ -192,7 +192,7 @@ std::map<std::string, std::string> installed_addons_and_versions()
} else if(filesystem::file_exists(get_info_file_path(addon_id))) {
config temp;
get_addon_install_info(addon_id, temp);
addons[addon_id] = !temp.empty() ? temp.child("info")["version"].str() : "Unknown";
addons[addon_id] = !temp.empty() && temp.has_child("info") ? temp.child("info")["version"].str() : "Unknown";
} else {
addons[addon_id] = "Unknown";
}
Expand Down

0 comments on commit 220792d

Please sign in to comment.