[Android] Avoid NPE

Geoffrey Métais git at videolan.org
Wed Feb 18 11:13:03 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 18 10:39:41 2015 +0100| [483f1b419bc2ff90a50ba970d10a9bcf07252c14] | committer: Geoffrey Métais

Avoid NPE

CID #1270674

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

 libvlc/src/org/videolan/libvlc/LibVlcUtil.java |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libvlc/src/org/videolan/libvlc/LibVlcUtil.java b/libvlc/src/org/videolan/libvlc/LibVlcUtil.java
index ae37868..2e7111c 100644
--- a/libvlc/src/org/videolan/libvlc/LibVlcUtil.java
+++ b/libvlc/src/org/videolan/libvlc/LibVlcUtil.java
@@ -271,7 +271,8 @@ public class LibVlcUtil {
             fileReader = new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq");
             br = new BufferedReader(fileReader);
             line = br.readLine();
-            frequency = Float.parseFloat(line) / 1000.f; /* Convert to MHz */
+            if (line != null)
+                frequency = Float.parseFloat(line) / 1000.f; /* Convert to MHz */
         } catch(IOException ex) {
             Log.w(TAG, "Could not find maximum CPU frequency!");
         } catch(NumberFormatException e) {



More information about the Android mailing list