From 1a3aaf86ee187f1839233cacd476d58043e131fa Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Thu, 10 Mar 2016 15:07:23 +0500 Subject: [PATCH] Fixing squid:S2259- Null pointers should not be dereferenced. --- app/src/main/java/org/schabi/newpipe/extractor/AudioStream.java | 2 +- app/src/main/java/org/schabi/newpipe/extractor/VideoStream.java | 2 +- .../extractor/services/youtube/YoutubeStreamExtractor.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/extractor/AudioStream.java b/app/src/main/java/org/schabi/newpipe/extractor/AudioStream.java index a464926c9..807ae666e 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/AudioStream.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/AudioStream.java @@ -40,7 +40,7 @@ public class AudioStream { // revelas wether two streams are equal public boolean equals(AudioStream cmp) { - return equalStats(cmp) + return cmp != null && equalStats(cmp) && url == cmp.url; } } diff --git a/app/src/main/java/org/schabi/newpipe/extractor/VideoStream.java b/app/src/main/java/org/schabi/newpipe/extractor/VideoStream.java index 8f49b193d..b1642f2c6 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/VideoStream.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/VideoStream.java @@ -38,7 +38,7 @@ public class VideoStream { // revelas wether two streams are equal public boolean equals(VideoStream cmp) { - return equalStats(cmp) + return cmp != null && equalStats(cmp) && url == cmp.url; } } diff --git a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java index 8574b71b4..1c1aca325 100644 --- a/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java +++ b/app/src/main/java/org/schabi/newpipe/extractor/services/youtube/YoutubeStreamExtractor.java @@ -599,7 +599,7 @@ public class YoutubeStreamExtractor extends StreamExtractor { public String getAverageRating() throws ParsingException { try { if (playerArgs == null) { - videoInfoPage.get("avg_rating"); + return videoInfoPage.get("avg_rating"); } return playerArgs.getString("avg_rating"); } catch (JSONException e) {