ConfigEditorFragment: Ensure localName is never null
Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
parent
be8b6017d5
commit
2f5494d47c
@ -34,7 +34,7 @@ public class ConfigEditorFragment extends BaseFragment {
|
|||||||
private static final String KEY_LOCAL_NAME = "local_name";
|
private static final String KEY_LOCAL_NAME = "local_name";
|
||||||
private static final String TAG = ConfigEditorFragment.class.getSimpleName();
|
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 ConfigEditorFragmentBinding binding;
|
||||||
private boolean isViewStateRestored;
|
private boolean isViewStateRestored;
|
||||||
private Config localConfig = new Config();
|
private Config localConfig = new Config();
|
||||||
@ -105,7 +105,7 @@ public class ConfigEditorFragment extends BaseFragment {
|
|||||||
} else if (getSelectedTunnel() == null && originalName != null) {
|
} else if (getSelectedTunnel() == null && originalName != null) {
|
||||||
localConfig = new Config();
|
localConfig = new Config();
|
||||||
originalName = null;
|
originalName = null;
|
||||||
localName.set(null);
|
localName.set("");
|
||||||
}
|
}
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
@ -184,13 +184,14 @@ public class ConfigEditorFragment extends BaseFragment {
|
|||||||
localConfig = null;
|
localConfig = null;
|
||||||
newTunnel.getConfigAsync().thenAccept(this::onConfigLoaded);
|
newTunnel.getConfigAsync().thenAccept(this::onConfigLoaded);
|
||||||
originalName = newTunnel.getName();
|
originalName = newTunnel.getName();
|
||||||
|
localName.set(originalName);
|
||||||
} else {
|
} else {
|
||||||
localConfig = new Config();
|
localConfig = new Config();
|
||||||
if (binding != null && isViewStateRestored)
|
if (binding != null && isViewStateRestored)
|
||||||
binding.setConfig(localConfig);
|
binding.setConfig(localConfig);
|
||||||
originalName = null;
|
originalName = null;
|
||||||
|
localName.set("");
|
||||||
}
|
}
|
||||||
localName.set(originalName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user