From fe348e390bccd7d6184581d0a13840363cfa9282 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Mon, 14 Jan 2008 15:21:57 +0000 Subject: INTEGRATION: CWS aquavcl04 (1.34.16); FILE MERGED 2007/12/11 17:17:28 pl 1.34.16.1: #i84470# catch a division by zero --- vcl/source/control/tabctrl.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index f8937483bebe..1a0924da1ed1 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -4,9 +4,9 @@ * * $RCSfile: tabctrl.cxx,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: hr $ $Date: 2007-11-02 12:52:27 $ + * last change: $Author: ihi $ $Date: 2008-01-14 16:21:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -608,8 +608,17 @@ Rectangle TabControl::ImplGetTabRect( USHORT nItemPos, long nWidth, long nHeight break; nIDX = 0; - nDX = (nWidth-nOffsetX-nLineWidthAry[n]) / (nLinePosAry[n+1]-i); - nModDX = (nWidth-nOffsetX-nLineWidthAry[n]) % (nLinePosAry[n+1]-i); + if( nLinePosAry[n+1]-i > 0 ) + { + nDX = (nWidth-nOffsetX-nLineWidthAry[n]) / (nLinePosAry[n+1]-i); + nModDX = (nWidth-nOffsetX-nLineWidthAry[n]) % (nLinePosAry[n+1]-i); + } + else + { + // FIXME: this is a bad case of tabctrl way too small + nDX = 0; + nModDX = 0; + } n++; } -- cgit