Check if the save_version is sane before comparing with it
This commit is contained in:
parent
62b17ea33f
commit
416ab3c281
1 changed files with 10 additions and 0 deletions
|
@ -657,6 +657,16 @@ void loadgame::check_version_compatibility()
|
|||
|
||||
const version_info save_version = gamestate_.classification().version;
|
||||
const version_info &wesnoth_version = game_config::wesnoth_version;
|
||||
// If the version isn't good, it probably isn't a compatible stable one,
|
||||
// and the following comparisons would throw.
|
||||
if (!save_version.good()) {
|
||||
const std::string message = _("The save has corrupt version information ($version_number|) and cannot be loaded.");
|
||||
utils::string_map symbols;
|
||||
symbols["version_number"] = gamestate_.classification().version;
|
||||
gui2::show_error_message(gui_.video(), utils::interpolate_variables_into_string(message, &symbols));
|
||||
throw load_game_cancelled_exception();
|
||||
}
|
||||
|
||||
// Even minor version numbers indicate stable releases which are
|
||||
// compatible with each other.
|
||||
if (wesnoth_version.minor_version() % 2 == 0 &&
|
||||
|
|
Loading…
Add table
Reference in a new issue