From 71dc4ff5a427df1b10fd363d852f1992f4d91ee8 Mon Sep 17 00:00:00 2001 From: Evan Ramos Date: Fri, 22 May 2020 00:17:32 -0500 Subject: [PATCH] SW: Fail gracefully from WarpToArea instead of aborting --- source/sw/src/warp.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/sw/src/warp.cpp b/source/sw/src/warp.cpp index 0a801baba..fb9633f44 100644 --- a/source/sw/src/warp.cpp +++ b/source/sw/src/warp.cpp @@ -183,6 +183,9 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum // exp: WARP_CEILING or WARP_CEILING_PLANE if (sp->hitag == to_tag) { + if ((unsigned)sp->sectnum >= MAXSECTORS) + return nullptr; + // determine new x,y,z position *x = sp->x + xoff; *y = sp->y + yoff; @@ -195,7 +198,6 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum *sectnum = sp->sectnum; updatesector(*x, *y, sectnum); - ASSERT(*sectnum >= 0); return sp; } }