do not validate port if hostname is empty. closes #3578

This commit is contained in:
Daniel Gultsch 2019-11-03 22:03:46 +01:00
parent f7b7464a65
commit 7f25d91d33

View file

@ -228,6 +228,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
removeErrorsOnAllBut(binding.hostnameLayout);
return;
}
if (!hostname.isEmpty()) {
try {
numericPort = Integer.parseInt(port);
if (numericPort < 0 || numericPort > 65535) {
@ -244,6 +245,7 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
return;
}
}
}
if (jid.getLocal() == null) {
if (mUsernameMode) {
@ -477,8 +479,13 @@ public class EditAccountActivity extends OmemoActivity implements OnAccountUpdat
}
private void updatePortLayout() {
String hostname = this.binding.hostname.getText().toString();
this.binding.portLayout.setEnabled(!TextUtils.isEmpty(hostname));
final String hostname = this.binding.hostname.getText().toString();
if (TextUtils.isEmpty(hostname)) {
this.binding.portLayout.setEnabled(false);
this.binding.portLayout.setError(null);
} else {
this.binding.portLayout.setEnabled(true);
}
}
protected void updateSaveButton() {