[vlc-devel] [PATCH] Qt4: Avoid a potential division by zero
Edward Wang
edward.c.wang at compdigitec.com
Sun Oct 21 17:28:01 CEST 2012
Fixes an annoying crash for me.
---
modules/gui/qt4/util/input_slider.cpp | 6 ++++--
1 files 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();
}
--
1.7.5.4
More information about the vlc-devel
mailing list