From 169139c22cb2b05d173b80398d07db5d2a1eabd5 Mon Sep 17 00:00:00 2001 From: Shiny Metagross <30511800+ShinyMetagross@users.noreply.github.com> Date: Wed, 30 Nov 2022 09:31:09 -0700 Subject: [PATCH] Fixed A_Changemodel crash from invalid modeldef names - Invalid modeldef names no longer result in a crash https://forum.zdoom.org/viewtopic.php?t=76810 --- src/playsim/p_actionfunctions.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/playsim/p_actionfunctions.cpp b/src/playsim/p_actionfunctions.cpp index 74faa78af2..ed8905b306 100644 --- a/src/playsim/p_actionfunctions.cpp +++ b/src/playsim/p_actionfunctions.cpp @@ -5123,6 +5123,11 @@ DEFINE_ACTION_FUNCTION(AActor, A_ChangeModel) if (self == nullptr) ACTION_RETURN_BOOL(false); + else if (modeldef != NAME_None && PClass::FindClass(modeldef.GetChars()) == nullptr) + { + Printf("Attempt to pass invalid modeldef name %s in %s.", modeldef.GetChars(), self->GetCharacterName()); + ACTION_RETURN_BOOL(false); + } else if (modelindex < 0) { Printf("Attempt to pass invalid model index %d in %s, index must be non-negative.", modelindex, self->GetCharacterName());