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