From aff8b0057584460114ba8ea97609a24fab8f9239 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 15 May 2016 09:16:37 +0200 Subject: [PATCH] - added NULL pointer checks to SpecialDropAction methods that call CheckLocalView. --- src/g_strife/a_strifeitems.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/g_strife/a_strifeitems.cpp b/src/g_strife/a_strifeitems.cpp index 45e8218e1..26ac88393 100644 --- a/src/g_strife/a_strifeitems.cpp +++ b/src/g_strife/a_strifeitems.cpp @@ -188,10 +188,13 @@ bool ARaiseAlarm::TryPickup (AActor *&toucher) bool ARaiseAlarm::SpecialDropAction (AActor *dropper) { - P_NoiseAlert (dropper->target, dropper->target); - if (dropper->target->CheckLocalView (consoleplayer)) + if (dropper->target != nullptr) { - Printf ("You Fool! You've set off the alarm.\n"); + P_NoiseAlert(dropper->target, dropper->target); + if (dropper->target->CheckLocalView(consoleplayer)) + { + Printf("You Fool! You've set off the alarm.\n"); + } } Destroy (); return true; @@ -237,11 +240,14 @@ bool ACloseDoor222::TryPickup (AActor *&toucher) bool ACloseDoor222::SpecialDropAction (AActor *dropper) { EV_DoDoor (DDoor::doorClose, NULL, dropper, 222, 2., 0, 0, 0); - if (dropper->target->CheckLocalView (consoleplayer)) + if (dropper->target != nullptr) { - Printf ("You're dead! You set off the alarm.\n"); + if (dropper->target->CheckLocalView(consoleplayer)) + { + Printf("You're dead! You set off the alarm.\n"); + } + P_NoiseAlert(dropper->target, dropper->target); } - P_NoiseAlert (dropper->target, dropper->target); Destroy (); return true; }