From d2e8675051fb53459cf4c78ddec5094cce605cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 18 Oct 2007 14:24:46 +0000 Subject: [PATCH] Avoid divide by zero. svn path=/trunk/KDE/kdebase/workspace/; revision=726668 --- effects/desktopgrid.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/effects/desktopgrid.cpp b/effects/desktopgrid.cpp index 323cac392c..a161b20ca3 100644 --- a/effects/desktopgrid.cpp +++ b/effects/desktopgrid.cpp @@ -403,8 +403,16 @@ void DesktopGridEffect::slideDesktopChanged( int old ) else // current position is not on current desktop, do full progress progress = 0; diffPos = rect.topLeft() - currentPos; - // Compute starting point for this new move (given current and end positions) - slide_start_pos = rect.topLeft() - diffPos * 1 / ( 1 - progress ); + if( progress <= 0 ) + { + // Compute starting point for this new move (given current and end positions) + slide_start_pos = rect.topLeft() - diffPos * 1 / ( 1 - progress ); + } + else + { // at the end, stop + slide = false; + progress = 0; + } } else {