diff options
author | cyberta <cyberta@riseup.net> | 2020-01-23 23:08:26 -0600 |
---|---|---|
committer | cyberta <cyberta@riseup.net> | 2020-01-23 23:08:26 -0600 |
commit | 46a05ee057275d1d37721bac560ae70c4b0e19de (patch) | |
tree | 9a293cedc22a38056adf83a5fa2f54b8eab239d3 /app | |
parent | c4aa8b7a5fc52627997a18f9d04669c8f9734dc2 (diff) |
fix potention NPEsin Provider class
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/Provider.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Provider.java b/app/src/main/java/se/leap/bitmaskclient/Provider.java index 88080a03..11d685f5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Provider.java +++ b/app/src/main/java/se/leap/bitmaskclient/Provider.java @@ -18,6 +18,7 @@ package se.leap.bitmaskclient; import android.os.Parcel; import android.os.Parcelable; +import android.support.annotation.NonNull; import com.google.gson.Gson; @@ -96,8 +97,12 @@ public final class Provider implements Parcelable { public Provider(String mainUrl, String providerIp, String providerApiIp) { try { this.mainUrl.setUrl(new URL(mainUrl)); - this.providerIp = providerIp; - this.providerApiIp = providerApiIp; + if (providerIp != null) { + this.providerIp = providerIp; + } + if (providerApiIp != null) { + this.providerApiIp = providerApiIp; + } } catch (MalformedURLException e) { e.printStackTrace(); } @@ -184,10 +189,12 @@ public final class Provider implements Parcelable { } public void setProviderApiIp(String providerApiIp) { + if (providerApiIp == null) return; this.providerApiIp = providerApiIp; } public void setProviderIp(String providerIp) { + if (providerIp == null) return; this.providerIp = providerIp; } |