From 65966badb285e8ee8ffeb8aeed3fa679edfba32e Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 7 Oct 2017 16:30:49 +0300 Subject: [PATCH] Fixed crash on attempt to register IDs for undefined class https://forum.zdoom.org/viewtopic.php?t=46670&start=16#p1021785 --- src/info.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/info.cpp b/src/info.cpp index 1eee76fcd..94b263105 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -355,8 +355,16 @@ void PClassActor::RegisterIDs() return; } + FActorInfo *actorInfo = ActorInfo(); + + if (nullptr == actorInfo) + { + // Undefined class, exiting + return; + } + // Conversation IDs have never been filtered by game so we cannot start doing that. - auto ConversationID = ActorInfo()->ConversationID; + auto ConversationID = actorInfo->ConversationID; if (ConversationID > 0) { StrifeTypes[ConversationID] = cls; @@ -365,9 +373,9 @@ void PClassActor::RegisterIDs() Printf(TEXTCOLOR_RED"Conversation ID %d refers to hidden class type '%s'\n", ConversationID, cls->TypeName.GetChars()); } } - if (ActorInfo()->GameFilter == GAME_Any || (ActorInfo()->GameFilter & gameinfo.gametype)) + if (actorInfo->GameFilter == GAME_Any || (ActorInfo()->GameFilter & gameinfo.gametype)) { - auto SpawnID = ActorInfo()->SpawnID; + auto SpawnID = actorInfo->SpawnID; if (SpawnID > 0) { SpawnableThings[SpawnID] = cls; @@ -376,7 +384,7 @@ void PClassActor::RegisterIDs() Printf(TEXTCOLOR_RED"Spawn ID %d refers to hidden class type '%s'\n", SpawnID, cls->TypeName.GetChars()); } } - auto DoomEdNum = ActorInfo()->DoomEdNum; + auto DoomEdNum = actorInfo->DoomEdNum; if (DoomEdNum != -1) { FDoomEdEntry *oldent = DoomEdMap.CheckKey(DoomEdNum);