[Android] Fix a division by zero

Ludovic Fauvet git at videolan.org
Wed Feb 27 14:21:21 CET 2013


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Feb 27 14:15:28 2013 +0100| [75e129e2361859fbfda8267f85238dc78da79e72] | committer: Ludovic Fauvet

Fix a division by zero

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

 .../src/org/videolan/vlc/gui/video/VideoPlayerActivity.java      |    6 +++++-
 1 file changed, 5 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 0d4599d..ce74df8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -693,8 +693,12 @@ public class VideoPlayerActivity extends Activity {
             dw = dh;
             dh = d;
         }
-        if (dw * dh == 0)
+
+        // sanity check
+        if (dw * dh == 0 || mVideoWidth * mVideoHeight == 0) {
+            Log.e(TAG, "Invalid surface size");
             return;
+        }
 
         // compute the aspect ratio
         double ar, vw;



More information about the Android mailing list