Add a safeguard to do not use uninitialized value

macos_ci_fix
Andrei Kortunov 1 year ago
parent 861b9b215c
commit 88fe328de1

@ -355,12 +355,12 @@ namespace MWWorld
template <class T, class Id>
RecordId TypedDynamicStore<T, Id>::read(ESM::ESMReader& reader, bool overrideOnly)
{
T record;
bool isDeleted = false;
if constexpr (!ESM::isESM4Rec(T::sRecordId))
{
T record;
bool isDeleted = false;
record.load(reader, isDeleted);
}
insert(record, overrideOnly);
if constexpr (std::is_same_v<Id, ESM::RefId>)
@ -368,6 +368,14 @@ namespace MWWorld
else
return RecordId();
}
else
{
std::stringstream msg;
msg << "Can not load record of type ESM::REC_" << getRecNameString(T::sRecordId).toStringView()
<< ": ESM::ESMReader can load only ESM3 records.";
throw std::runtime_error(msg.str());
}
}
// LandTexture
//=========================================================================

Loading…
Cancel
Save