[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] check empty names
commit 17efdcafa29be4304e9f4571b24ddbaf0fc41218
Author: arrase <arrase@xxxxxxxxx>
Date: Thu Nov 24 03:06:40 2016 +0100
check empty names
---
.../android/ui/hiddenservices/dialogs/HSDataDialog.java | 9 +++++++--
app/src/main/res/values/strings.xml | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
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 0b04135..f8ce1fd 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 3e37d3d..97f2798 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -349,4 +349,5 @@
<string name="permission_denied">Permission denied</string>
<string name="restore_backup">Restore Backup</string>
<string name="create_a_backup_first">Create a backup first</string>
+ <string name="name_can_t_be_empty">Name can't be empty</string>
</resources>
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits