Fix infinite loop when script object load fails

This commit is contained in:
Luke Street 2022-03-14 02:07:16 -04:00
parent 69d0ad1fd9
commit cdcfc7eccc
1 changed files with 2 additions and 9 deletions

View File

@ -1556,15 +1556,8 @@ std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, ESc
}
if (error || ent == nullptr) {
while (in.GetReadPosition() != startPos) {
in.ReadChar();
}
const std::string name = HashInstanceName(in);
while (in.GetReadPosition() != startPos + length) {
in.ReadChar();
}
LogModule.report(logvisor::Error, FMT_STRING("Script load error while loading {}, name: {}"),
ScriptObjectTypeToStr(type), name);
LogModule.report(logvisor::Error, FMT_STRING("Script load error while loading {} (Editor ID: {}, Area: {})"),
ScriptObjectTypeToStr(type), id, aid);
return {kInvalidEditorId, kInvalidUniqueId};
} else {
#ifndef NDEBUG