From e925aeacab9a9fb4637d2ec6d850bffa7228e050 Mon Sep 17 00:00:00 2001 From: Jeremy Joslin Date: Wed, 8 Feb 2017 14:50:34 -0800 Subject: [PATCH] Check for null inputs in the ctor. Test: gts-tradefed run gts -m GtsGmscoreHostTestCases -t com.google.android.gts.wifi.WifiHostTest Bug: 35152108 Change-Id: I321b52b0feb62aced20bca7f47e962f5c7d78343 --- core/java/android/net/WifiKey.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/android/net/WifiKey.java b/core/java/android/net/WifiKey.java index 99de99ece1e5d..68b505d49da6d 100644 --- a/core/java/android/net/WifiKey.java +++ b/core/java/android/net/WifiKey.java @@ -64,10 +64,10 @@ public class WifiKey implements Parcelable { * @throws IllegalArgumentException if either the SSID or BSSID is invalid. */ public WifiKey(String ssid, String bssid) { - if (!SSID_PATTERN.matcher(ssid).matches()) { + if (ssid == null || !SSID_PATTERN.matcher(ssid).matches()) { throw new IllegalArgumentException("Invalid ssid: " + ssid); } - if (!BSSID_PATTERN.matcher(bssid).matches()) { + if (bssid == null || !BSSID_PATTERN.matcher(bssid).matches()) { throw new IllegalArgumentException("Invalid bssid: " + bssid); } this.ssid = ssid;