From 20741efd3b6df238d3012f8354b6fbbbb386fe08 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 1 Feb 2012 21:51:26 +0000 Subject: [PATCH] Fix a sector[-1] access when starting to draw a wall in an empty map. git-svn-id: https://svn.eduke32.com/eduke32@2305 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/build.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 43b3a6ce3..48b47f4f2 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -3090,14 +3090,14 @@ void overheadeditor(void) } i = numwalls-1; - j = numsectors-1; + j = numsectors-1; // might be -1 if empty map! if (newnumwalls >= 0) i = newnumwalls-1; for (; i>=0; i--) { const walltype *wal = &wall[i]; - if (sector[j].wallptr > i) + if (j>=0 && sector[j].wallptr > i) j--; if (zoom < 768 && !(wal->cstat & (1<<14))) @@ -3115,7 +3115,7 @@ void overheadeditor(void) dax = (wal->x+wall[wal->point2].x)>>1; day = (wal->y+wall[wal->point2].y)>>1; drawsmallabel(dabuffer, editorcolors[0], editorcolors[31], - dax, day, getflorzofslope(j, dax,day)); + dax, day, (i >= numwalls || j<0) ? 0 : getflorzofslope(j, dax,day)); } }