[Android] Prevent division by zero

Geoffrey Métais git at videolan.org
Thu May 7 16:29:25 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May  7 14:22:48 2015 +0200| [c1eacd696e8470c275570d6793b843581fa37d92] | committer: Geoffrey Métais

Prevent division by zero

CID #1297072, #1270654

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=c1eacd696e8470c275570d6793b843581fa37d92
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java |    2 ++
 vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java         |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index 74e243d..d499dce 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -1893,6 +1893,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVideoPlay
     }
 
     private void doSeekTouch(int coef, float gesturesize, boolean seek) {
+        if (coef == 0)
+            coef = 1;
         // No seek action if coef > 0.5 and gesturesize < 1cm
         if (Math.abs(gesturesize) < 1 || !mCanSeek)
             return;
diff --git a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
index 243dea3..a60081e 100644
--- a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
+++ b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
@@ -261,7 +261,7 @@ public class FlingViewGroup extends ViewGroup {
     public void scrollTo(int position) {
         mCurrentView = position;
         final int delta = (position * getWidth()) - getScrollX();
-        mScroller.startScroll(getScrollX(), 0, delta, 0, 0);
+        mScroller.startScroll(getScrollX(), 0, delta, 0, 1);
         invalidate();
     }
 



More information about the Android mailing list