From e5a2d5af3ccbdffc247ad7d96b9b5b45127a48d7 Mon Sep 17 00:00:00 2001 From: "Randall E. Barker" Date: Mon, 22 Jul 2019 02:05:28 -0700 Subject: [PATCH] Fix java.lang.NullPointerException in checkYoutubeOverride (#1437) --- .../org/mozilla/vrbrowser/browser/SessionStore.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java index 13ab34f60..ae735a0ba 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/SessionStore.java @@ -1113,14 +1113,20 @@ else if (aRequest.triggerUri != null) private String checkYoutubeOverride(String aUri) { try { Uri uri = Uri.parse(aUri); + if (uri.getHost() == null) { + return null; + } String hostLower = uri.getHost().toLowerCase(); if (!hostLower.endsWith(".youtube.com") && !hostLower.endsWith(".youtube-nocookie.com")) { return null; } Uri.Builder uriBuilder = uri.buildUpon(); - Boolean updateUri = false; + boolean updateUri = false; + if (uri.getScheme() == null) { + return null; + } if (!uri.getScheme().equalsIgnoreCase("https")) { uriBuilder.scheme("https"); updateUri = true;