From 6eb4413fb831faf978b1ffb01b3f7e46b1f08875 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Wed, 31 Jul 2024 14:42:41 +0200 Subject: [PATCH] Protect against invalid readyweapon (#1807) Co-authored-by: kraflab --- src/p_pspr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/p_pspr.c b/src/p_pspr.c index 164428805..d5238dcfe 100644 --- a/src/p_pspr.c +++ b/src/p_pspr.c @@ -586,7 +586,10 @@ void A_Lower(player_t *player, pspdef_t *psp) return; } - player->readyweapon = player->pendingweapon; + if (player->pendingweapon < NUMWEAPONS || !mbf21) + { + player->readyweapon = player->pendingweapon; + } P_BringUpWeapon(player); }