Mass,Profile: improve safety by checking the save type.
This commit is contained in:
parent
6b280b2668
commit
11c089d408
2 changed files with 8 additions and 0 deletions
|
@ -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);
|
auto unit_data = _mass->at<GenericStructProperty>("UnitData"_s);
|
||||||
if(!unit_data) {
|
if(!unit_data) {
|
||||||
Utility::Error{} << "Couldn't find unit data in" << _filename;
|
Utility::Error{} << "Couldn't find unit data in" << _filename;
|
||||||
|
|
|
@ -106,6 +106,10 @@ void Profile::refreshValues() {
|
||||||
return;
|
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);
|
auto name_prop = _profile.at<StringProperty>("CompanyName"_s);
|
||||||
if(!name_prop) {
|
if(!name_prop) {
|
||||||
_lastError = "No company name in "_s + _filename;
|
_lastError = "No company name in "_s + _filename;
|
||||||
|
|
Loading…
Reference in a new issue