[Android] Avoid NPE

Steve Lhomme robux4 at gmail.com
Wed Feb 18 11:21:29 CET 2015


Doesn't readLine() returning `null` mean this is the EOF and reading should
be stopped ?

On Wed, Feb 18, 2015 at 11:13 AM, Geoffrey Métais <git at videolan.org> wrote:

> 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) {
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20150218/3ffa7459/attachment.html>


More information about the Android mailing list