From bc5c74293074d27afa47d3f2450a31032cab3fa5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 5 Jun 2022 09:40:10 +0200 Subject: [PATCH] - Duke: fixed some crashes with bad map setups --- source/games/duke/src/_polymost.cpp | 4 ++-- source/games/duke/src/actors_d.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/games/duke/src/_polymost.cpp b/source/games/duke/src/_polymost.cpp index bfe3e8dd4f8..10edfdd6eb2 100644 --- a/source/games/duke/src/_polymost.cpp +++ b/source/games/duke/src/_polymost.cpp @@ -159,7 +159,7 @@ void se40code(int x, int y, int z, binangle a, fixedhoriz h, int smoothratio) void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz choriz, int smoothratio) { - if (testgotpic(TILE_MIRROR, true)) + if (mirrorcnt > 0 && testgotpic(TILE_MIRROR, true)) { int dst = 0x7fffffff, i = 0; for (int k = 0; k < mirrorcnt; k++) @@ -168,7 +168,7 @@ void renderMirror(int cposx, int cposy, int cposz, binangle cang, fixedhoriz cho if (j < dst) dst = j, i = k; } - if (mirrorwall[i]->overpicnum == TILE_MIRROR) + if (mirrorwall[i] && mirrorwall[i]->overpicnum == TILE_MIRROR) { int tposx, tposy; fixed_t tang; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 2b9d55cd1c4..3be4c3e54cc 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -3510,7 +3510,7 @@ void moveeffectors_d(void) //STATNUM 3 auto sc = act->sector(); if (sc->wallnum != 4) continue; auto wal = sc->firstWall() + 2; - alignflorslope(act->sector(), wal->wall_int_pos().X, wal->wall_int_pos().Y, wal->nextSector()->floorz); + if (wal->nextSector()) alignflorslope(act->sector(), wal->wall_int_pos().X, wal->wall_int_pos().Y, wal->nextSector()->floorz); } }