diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDataDialog.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDataDialog.java
index 0b04135b..f8ce1fdc 100644
--- a/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDataDialog.java
+++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/dialogs/HSDataDialog.java
@@ -42,7 +42,7 @@ public class HSDataDialog extends DialogFragment {
((EditText) dialog_view.findViewById(R.id.hsOnionPort)).getText().toString()
);
- if (checkInput(localPort, onionPort)) {
+ if (checkInput(serverName, localPort, onionPort)) {
saveData(serverName, localPort, onionPort);
serviceDataDialog.dismiss();
}
@@ -59,7 +59,7 @@ public class HSDataDialog extends DialogFragment {
return serviceDataDialog;
}
- private boolean checkInput(Integer local, Integer remote) {
+ private boolean checkInput(String serverName, Integer local, Integer remote) {
boolean is_ok = true;
Integer error_msg = 0;
@@ -68,6 +68,11 @@ public class HSDataDialog extends DialogFragment {
is_ok = false;
}
+ if (serverName == null || serverName.length() < 1) {
+ error_msg = R.string.name_can_t_be_empty;
+ is_ok = false;
+ }
+
if (!is_ok) {
Toast.makeText(getContext(), error_msg, Toast.LENGTH_SHORT).show();
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 3e37d3d0..97f27983 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -349,4 +349,5 @@
Permission denied
Restore Backup
Create a backup first
+ Name can't be empty