From 8e2d324e8509d9be017768335818285086b3b90d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 8 Dec 2021 19:19:10 +0100 Subject: [PATCH] - fixed: updatesectorneighborz may not return -1. This value gets never validated by any caller and isn't really what is wanted in this situation. --- source/build/src/engine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index df0e36883..759f73f5e 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -476,9 +476,10 @@ int32_t spriteheightofsptr(uspriteptr_t spr, int32_t *height, int32_t alsotileyo // 1: floor or down int32_t nextsectorneighborz(int16_t sectnum, int32_t refz, int16_t topbottom, int16_t direction) { - int32_t nextz = (direction==1) ? INT32_MAX : INT32_MIN; - int32_t sectortouse = -1; + int32_t nextz = (direction == 1) ? INT32_MAX : INT32_MIN; + int32_t sectortouse = sectnum; // was -1, which is bad because no caller checks it. + assert(validSectorIndex(sectnum)); auto wal = (uwallptr_t)sector[sectnum].firstWall(); int32_t i = sector[sectnum].wallnum;