Hardening: unknown vehicle= in the egg fails loud instead of segfaulting
Found during the #35 (Owens laser crash) hunt: FindResourceDescription returns NULL for an unknown vehicle name and release builds (Check compiled out) segfaulted on Lock() -- a typo'd or corrupted vehicle tag in a served egg would crash EVERY pod at drop. Now logs '[spawn] FATAL: unknown vehicle' + Fail() with a clean exit. Verified: vehicle=nosuch -> message + exit 127 (was a segfault). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
72a8b124f9
commit
3d8bfdeba6
@@ -930,7 +930,21 @@ void
|
||||
playerMission->GetGameModel(),
|
||||
ResourceDescription::ModelListResourceType
|
||||
);
|
||||
Check(mech_res);
|
||||
//
|
||||
// HARDENING (found during the #35 hunt): an unknown vehicle= name in
|
||||
// the egg (a typo, or a corrupted relay rewrite) returned NULL here
|
||||
// and SEGFAULTED on Lock() in release (Check compiles out). A bad
|
||||
// tag in a served egg would crash EVERY pod -- fail loud instead.
|
||||
//
|
||||
if (mech_res == 0)
|
||||
{
|
||||
DEBUG_STREAM << "[spawn] FATAL: unknown vehicle '"
|
||||
<< (playerMission->GetGameModel()
|
||||
? playerMission->GetGameModel() : "<null>")
|
||||
<< "' in the egg (no such ModelList resource)\n" << std::flush;
|
||||
Fail("unknown vehicle= name in the egg -- check the mission file\n");
|
||||
return;
|
||||
}
|
||||
mech_res->Lock();
|
||||
|
||||
Mech::MakeMessage
|
||||
|
||||
Reference in New Issue
Block a user