Commit 8e993663 authored by Geoffrey Métais's avatar Geoffrey Métais

Prevent NPE

parent 69cd9a50
...@@ -121,18 +121,20 @@ public class NetworkServerDialog extends DialogFragment implements AdapterView.O ...@@ -121,18 +121,20 @@ public class NetworkServerDialog extends DialogFragment implements AdapterView.O
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
mEditAddress.setText(mUri.getHost()); if (mUri != null) {
if (!TextUtils.isEmpty(mUri.getUserInfo())) mEditAddress.setText(mUri.getHost());
mEditUsername.setText(mUri.getUserInfo()); if (!TextUtils.isEmpty(mUri.getUserInfo()))
if (!TextUtils.isEmpty(mUri.getPath())) mEditUsername.setText(mUri.getUserInfo());
mEditFolder.setText(mUri.getPath().substring(1)); if (!TextUtils.isEmpty(mUri.getPath()))
if (!TextUtils.isEmpty(mName)) mEditFolder.setText(mUri.getPath().substring(1));
mEditServername.setText(mName); if (!TextUtils.isEmpty(mName))
mEditServername.setText(mName);
int position = getProtocolSpinnerPosition(mUri.getScheme().toUpperCase());
mSpinnerProtocol.setSelection(position); int position = getProtocolSpinnerPosition(mUri.getScheme().toUpperCase());
int port = mUri.getPort(); mSpinnerProtocol.setSelection(position);
mEditPort.setText(port != -1 ? String.valueOf(port) : getPortForProtocol(position)); int port = mUri.getPort();
mEditPort.setText(port != -1 ? String.valueOf(port) : getPortForProtocol(position));
}
} }
private void saveServer() { private void saveServer() {
String name = (TextUtils.isEmpty(mEditServername.getText().toString())) ? String name = (TextUtils.isEmpty(mEditServername.getText().toString())) ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment