summaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-07 00:25:33 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-07 00:25:33 -0600
commit2f5494d47cc965fb0681ce0609e6386b2805dc02 (patch)
tree13e81fd015b3dcf985492411c05c56a8ac261eaa /app/src
parentbe8b6017d504cdc791f9578ea196934e652b1af6 (diff)
ConfigEditorFragment: Ensure localName is never null
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/ConfigEditorFragment.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/ConfigEditorFragment.java b/app/src/main/java/com/wireguard/android/fragment/ConfigEditorFragment.java
index e2f5aa02..582ead93 100644
--- a/app/src/main/java/com/wireguard/android/fragment/ConfigEditorFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/ConfigEditorFragment.java
@@ -34,7 +34,7 @@ public class ConfigEditorFragment extends BaseFragment {
private static final String KEY_LOCAL_NAME = "local_name";
private static final String TAG = ConfigEditorFragment.class.getSimpleName();
- private final ObservableField<String> localName = new ObservableField<>();
+ private final ObservableField<String> localName = new ObservableField<>("");
private ConfigEditorFragmentBinding binding;
private boolean isViewStateRestored;
private Config localConfig = new Config();
@@ -105,7 +105,7 @@ public class ConfigEditorFragment extends BaseFragment {
} else if (getSelectedTunnel() == null && originalName != null) {
localConfig = new Config();
originalName = null;
- localName.set(null);
+ localName.set("");
}
setHasOptionsMenu(true);
}
@@ -184,13 +184,14 @@ public class ConfigEditorFragment extends BaseFragment {
localConfig = null;
newTunnel.getConfigAsync().thenAccept(this::onConfigLoaded);
originalName = newTunnel.getName();
+ localName.set(originalName);
} else {
localConfig = new Config();
if (binding != null && isViewStateRestored)
binding.setConfig(localConfig);
originalName = null;
+ localName.set("");
}
- localName.set(originalName);
}
@Override