From a55219fbf1ffab82275cca9ab6a375ff831e689b Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 17 Feb 2022 18:11:38 +0000 Subject: [PATCH] Fix a potential NPE in test_utils WebServerDispatcher PiperOrigin-RevId: 429338648 --- .../android/exoplayer2/testutil/WebServerDispatcher.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/WebServerDispatcher.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/WebServerDispatcher.java index a02c482196..88fc83c467 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/WebServerDispatcher.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/WebServerDispatcher.java @@ -28,6 +28,7 @@ import androidx.annotation.IntDef; import androidx.annotation.Nullable; import com.google.android.exoplayer2.util.Util; import com.google.common.base.Joiner; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; @@ -239,7 +240,7 @@ public class WebServerDispatcher extends Dispatcher { /** Returns the path for a given {@link RecordedRequest}, stripping any query parameters. */ public static String getRequestPath(RecordedRequest request) { - return Util.splitAtFirst(request.getPath(), "\\?")[0]; + return Util.splitAtFirst(Strings.nullToEmpty(request.getPath()), "\\?")[0]; } /**