From 059e8ebe52d1a863d1f2a13362c378ae6728581b Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 14 Apr 2012 13:04:31 +0000 Subject: [PATCH] Fix a null pointer access in Polymer mouse picking. Specifically, it was in the "determine searchwall when aiming at floor or ceiling" part. Now, if prsectors[]->ceil.plane (or ->floor.plane) is NULL, we set the searchwall to the sector's firstwall and return. git-svn-id: https://svn.eduke32.com/eduke32@2610 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index d01710324..a3a2c1061 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -1204,9 +1204,15 @@ void polymer_editorpick(void) else { if (searchstat==1) - pl = &(prsectors[searchsector]->ceil.plane[0]); + pl = prsectors[searchsector]->ceil.plane; else - pl = &(prsectors[searchsector]->floor.plane[0]); + pl = prsectors[searchsector]->floor.plane; + + if (pl == NULL) + { + searchwall = sector[num].wallptr; + return; + } t = dot3f(pl,scrv); svcoeff = -(dot3f(pl,scr)+pl[3])/t;