Merge pull request #67 from dddddd-mmmmmm/issue-25
#25 Add null check to fix crash whilst offline
This commit is contained in:
commit
e7ea8d4dfc
|
@ -301,6 +301,8 @@ public final class Util {
|
||||||
private static String getRestUrl(Context context, String method, SharedPreferences prefs, int instance, boolean allowAltAddress, @Nullable Map<String, String> parameters) {
|
private static String getRestUrl(Context context, String method, SharedPreferences prefs, int instance, boolean allowAltAddress, @Nullable Map<String, String> parameters) {
|
||||||
String serverUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_URL + instance, null);
|
String serverUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_URL + instance, null);
|
||||||
|
|
||||||
|
if (serverUrl == null) return "OFFLINE";
|
||||||
|
|
||||||
HttpUrl.Builder builder;
|
HttpUrl.Builder builder;
|
||||||
builder = HttpUrl.parse(serverUrl).newBuilder();
|
builder = HttpUrl.parse(serverUrl).newBuilder();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue