Fix a theoretical NPE
Test: NetworkAgentTests
Bug: 153718627
Change-Id: I955b6dac6de48b12696dc640f131f5983ac552df
Merged-In: I08f57cce0cd85d5cd66e9a0ef948224290e9200e
(cherry picked from commit 31492c708746a51f70c74913a4d6cd97bf06ae63, aosp/1284575)
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java
index e9bcefe..31d7d08 100644
--- a/core/java/android/net/NetworkAgent.java
+++ b/core/java/android/net/NetworkAgent.java
@@ -812,7 +812,7 @@
* this is the destination the probes are being redirected to, otherwise {@code null}.
*/
public void onValidationStatus(@ValidationStatus int status, @Nullable Uri redirectUri) {
- networkStatus(status, redirectUri.toString());
+ networkStatus(status, null == redirectUri ? "" : redirectUri.toString());
}
/** @hide TODO delete once subclasses have moved to onValidationStatus */
protected void networkStatus(int status, String redirectUrl) {