From 24c73071f438cb6d536b27bfdfc79fe2de4c268f Mon Sep 17 00:00:00 2001
From: Leonard2 <hobbax3@gmail.com>
Date: Fri, 17 Jun 2016 09:35:10 +0200
Subject: [PATCH] Fixed a crash with A_JumpIfNoAmmo

Non-weapon layers can pass the caller check even when there is no ReadyWeapon
---
 src/thingdef/thingdef_codeptr.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp
index 7a0dd207e..610b6b17e 100644
--- a/src/thingdef/thingdef_codeptr.cpp
+++ b/src/thingdef/thingdef_codeptr.cpp
@@ -1740,7 +1740,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfNoAmmo)
 	PARAM_ACTION_PROLOGUE;
 	PARAM_STATE(jump);
 
-	if (!ACTION_CALL_FROM_PSPRITE())
+	if (!ACTION_CALL_FROM_PSPRITE() || self->player->ReadyWeapon == nullptr)
 	{
 		ACTION_RETURN_STATE(NULL);
 	}