From 5085dcd866fc747c12e38f2613ced7bfca2af0b1 Mon Sep 17 00:00:00 2001 From: Mitch Richters Date: Sun, 5 Dec 2021 17:15:49 +1100 Subject: [PATCH] - SW: Add nullptr check inside `DoPlayerHorizon()` for `canslopetilt` to prevent crashes while noclipping through level. --- source/games/sw/src/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index e27a2973a..40006785a 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1610,7 +1610,7 @@ void SlipSlope(PLAYERp pp) void DoPlayerHorizon(PLAYERp pp, float const horz, double const scaleAdjust) { - bool const canslopetilt = !TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING) && TEST(pp->cursector->floorstat, FLOOR_STAT_SLOPE); + bool const canslopetilt = !TEST(pp->Flags, PF_FLYING|PF_SWIMMING|PF_DIVING|PF_CLIMBING|PF_JUMPING|PF_FALLING) && pp->cursector && TEST(pp->cursector->floorstat, FLOOR_STAT_SLOPE); pp->horizon.calcviewpitch(pp->pos.vec2, pp->angle.ang, pp->input.actions & SB_AIMMODE, canslopetilt, pp->cursector, scaleAdjust, TEST(pp->Flags, PF_CLIMBING)); pp->horizon.applyinput(horz, &pp->input.actions, scaleAdjust); }