From ad5900b2edd29d5f180f29b44dfa7abb8646c650 Mon Sep 17 00:00:00 2001 From: Per Inge Mathisen Date: Wed, 25 Jul 2007 22:17:04 +0000 Subject: [PATCH] Fix crash in design screen if we draw a weapon component that is really really big. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2194 4a71c877-e1ca-e34f-864e-861f7616d084 --- lib/widget/bar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/widget/bar.c b/lib/widget/bar.c index 90b6c4940..585fa0a88 100644 --- a/lib/widget/bar.c +++ b/lib/widget/bar.c @@ -169,7 +169,7 @@ void widgSetBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD iValue) psBGraph->iValue = psBGraph->iRange; } - size = WBAR_SCALE * psBGraph->iValue / psBGraph->iRange; + size = WBAR_SCALE * psBGraph->iValue / MAX(psBGraph->iRange, 1); psBGraph->majorSize = (UWORD)size; } @@ -191,7 +191,7 @@ void widgSetMinorBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD iValue ) return; } - size = WBAR_SCALE * iValue / psBGraph->iRange; + size = WBAR_SCALE * iValue / MAX(psBGraph->iRange, 1); if (size > WBAR_SCALE) { size = WBAR_SCALE;