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 9252b7b commit 070b7ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog.md
@@ -1,4 +1,6 @@
## Version 1.14.14+dev
### Add-ons client
* Fix potential crashes when working with installed add-ons that have a corrupted _info.cfg file.
### Campaigns
* Descent into Darkness:
* S11: fix low probability case of enemy being unreachable
Expand Down
2 changes: 1 addition & 1 deletion src/addon/manager.cpp
Expand Up @@ -175,7 +175,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 070b7ed

Please sign in to comment.