[vlc-commits] Qt4: Avoid a potential division by zero

Edward Wang git at videolan.org
Mon Oct 22 10:59:14 CEST 2012


vlc | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Oct 21 11:28:01 2012 -0400| [8dd70b01420fd64e1717a8f1aa0b5b95f8320f4b] | committer: Jean-Baptiste Kempf

Qt4: Avoid a potential division by zero

Fixes an annoying crash for me.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8dd70b01420fd64e1717a8f1aa0b5b95f8320f4b
---

 modules/gui/qt4/util/input_slider.cpp |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 048b7f2..58819ba 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -303,8 +303,10 @@ void SeekSlider::mouseMoveEvent( QMouseEvent *event )
 
         QPoint target( event->globalX() - ( event->x() - posX ),
                   QWidget::mapToGlobal( QPoint( 0, 0 ) ).y() );
-        secstotimestr( psz_length, ( ( posX - margin ) * inputLength ) / ( size().width() - handleLength() ) );
-        mTimeTooltip->setTip( target, psz_length, chapterLabel );
+        if( likely( size().width() > handleLength() ) ) {
+            secstotimestr( psz_length, ( ( posX - margin ) * inputLength ) / ( size().width() - handleLength() ) );
+            mTimeTooltip->setTip( target, psz_length, chapterLabel );
+        }
     }
     event->accept();
 }



More information about the vlc-commits mailing list