Mass,Profile: improve safety by checking the save type.

This commit is contained in:
Guillaume Jacquemin 2022-04-02 19:54:32 +02:00
parent 6b280b2668
commit 11c089d408
2 changed files with 8 additions and 0 deletions

View File

@ -106,6 +106,10 @@ void Mass::refreshValues() {
}
}
if(_mass->saveType() != "/Game/Core/Save/bpSaveGameUnit.bpSaveGameUnit_C"_s) {
Utility::Error{} << _filename << "is not a valid unit save.";
}
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
if(!unit_data) {
Utility::Error{} << "Couldn't find unit data in" << _filename;

View File

@ -106,6 +106,10 @@ void Profile::refreshValues() {
return;
}
if(_profile.saveType() != "/Game/Core/Save/bpSaveGameProfile.bpSaveGameProfile_C"_s) {
Utility::Error{} << _filename << "is not a valid profile save.";
}
auto name_prop = _profile.at<StringProperty>("CompanyName"_s);
if(!name_prop) {
_lastError = "No company name in "_s + _filename;