From 4353170b47c68afd54ec0701add8c827debc7c3b Mon Sep 17 00:00:00 2001 From: helixhorned Date: Wed, 13 Jun 2012 23:13:31 +0000 Subject: [PATCH] Fix a div by zero in polymost_internal_nonparallaxed. git-svn-id: https://svn.eduke32.com/eduke32@2758 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 609517dee..6ec9c8240 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -3205,7 +3205,9 @@ static void polymost_internal_nonparallaxed(double nx0, double ny0, double nx1, } gdx = 0; gdy = gxyaspect; - if (!(globalorientation&2)) gdy /= (double)(global_cf_z-globalposz); + if (!(globalorientation&2)) + if (global_cf_z-globalposz) // PK 2012: don't allow div by zero + gdy /= (double)(global_cf_z-globalposz); gdo = -ghoriz*gdy; if (globalorientation&8) { ft[0] /= 8; ft[1] /= -8; ft[2] /= 2097152; ft[3] /= 2097152; } else { ft[0] /= 16; ft[1] /= -16; ft[2] /= 4194304; ft[3] /= 4194304; }