From a7322a7ff3f48a7ab9a21471757c06386de8c58b Mon Sep 17 00:00:00 2001 From: vadym Date: Sat, 8 Aug 2020 05:43:02 -0700 Subject: [PATCH] 1. added new peer input fields checks --- .../github/chronosx88/yggdrasil/PeerListActivity.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt b/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt index bd248d7..f09a863 100644 --- a/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt +++ b/app/src/main/java/io/github/chronosx88/yggdrasil/PeerListActivity.kt @@ -161,8 +161,20 @@ class PeerListActivity : AppCompatActivity() { var portInput = view.findViewById(R.id.portInput) var ccpInput = view.findViewById(R.id.ccp) var schema = schemaInput.text.toString().toLowerCase() + if(schema.isEmpty()){ + schemaInput.error = "Schema is required" + } var ip = ipInput.text.toString().toLowerCase() + if(ip.isEmpty()){ + ipInput.error = "IP address is required" + } var port = portInput.text.toString().toInt() + if(port<=0){ + portInput.error = "Port should be > 0" + } + if(port>=Short.MAX_VALUE){ + portInput.error = "Port should be < "+Short.MAX_VALUE + } var ccp = ccpInput.selectedCountryNameCode GlobalScope.launch { var pi = PeerInfo(schema, InetAddress.getByName(ip), port, ccp)