Fix a possible NULL pointer dereference...
...when a saved game's campaign is not present (reported by UMC Invasion from the Unknown)
This commit is contained in:
parent
c6187b7c67
commit
fd632a6b96
1 changed files with 9 additions and 3 deletions
|
@ -549,9 +549,15 @@ void save_preview_pane::draw_contents()
|
|||
|
||||
if(campaign_type == "scenario") {
|
||||
const config* campaign = game_config_->find_child("campaign","id",summary["campaign"]);
|
||||
utils::string_map symbols;
|
||||
symbols["campaign_name"] = (*campaign)["name"];
|
||||
str << vgettext("Campaign: $campaign_name", symbols); // FIXME: isn't this superfluous?
|
||||
if (campaign != NULL) {
|
||||
utils::string_map symbols;
|
||||
symbols["campaign_name"] = (*campaign)["name"];
|
||||
//!@todo FIXME: this is a superfluous manner of making the string, however, I'll keep it
|
||||
//! for the sake of not messing with the human side of i18n
|
||||
str << vgettext("Campaign: $campaign_name", symbols); // FIXME: isn't this superfluous?
|
||||
} else {
|
||||
str << _("#(unknown campaign)");
|
||||
}
|
||||
} else if(campaign_type == "multiplayer") {
|
||||
str << _("Multiplayer");
|
||||
} else if(campaign_type == "tutorial") {
|
||||
|
|
Loading…
Add table
Reference in a new issue