Avoid divide by zero.

svn path=/trunk/KDE/kdebase/workspace/; revision=726668
This commit is contained in:
Luboš Luňák 2007-10-18 14:24:46 +00:00
parent 61fa445581
commit d2e8675051

View file

@ -403,9 +403,17 @@ void DesktopGridEffect::slideDesktopChanged( int old )
else // current position is not on current desktop, do full progress else // current position is not on current desktop, do full progress
progress = 0; progress = 0;
diffPos = rect.topLeft() - currentPos; diffPos = rect.topLeft() - currentPos;
if( progress <= 0 )
{
// Compute starting point for this new move (given current and end positions) // Compute starting point for this new move (given current and end positions)
slide_start_pos = rect.topLeft() - diffPos * 1 / ( 1 - progress ); slide_start_pos = rect.topLeft() - diffPos * 1 / ( 1 - progress );
} }
else
{ // at the end, stop
slide = false;
progress = 0;
}
}
else else
{ {
progress = 0; progress = 0;