Commit 67222d6b authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Don't add the server to any list if it is empty

parent aab090de
...@@ -761,7 +761,7 @@ public class MainActivity extends NavigationDrawerActivity implements RuleImport ...@@ -761,7 +761,7 @@ public class MainActivity extends NavigationDrawerActivity implements RuleImport
dialog.show(); dialog.show();
((MainFragment)currentFragment()).checkDNSReachability(new MainFragment.DNSReachabilityCallback() { ((MainFragment)currentFragment()).checkDNSReachability(new MainFragment.DNSReachabilityCallback() {
@Override @Override
public void checkFinished(@NonNull List<IPPortPair> unreachable, List<IPPortPair> reachable) { public void checkFinished(@NonNull List<IPPortPair> unreachable, @NonNull List<IPPortPair> reachable) {
dialog.dismiss(); dialog.dismiss();
if(unreachable.size() == 0){ if(unreachable.size() == 0){
MainActivity.this.runOnUiThread(new Runnable() { MainActivity.this.runOnUiThread(new Runnable() {
......
...@@ -496,11 +496,11 @@ public class MainFragment extends Fragment { ...@@ -496,11 +496,11 @@ public class MainFragment extends Fragment {
public abstract void checkFinished(@NonNull List<IPPortPair> unreachable, @NonNull List<IPPortPair> reachable); public abstract void checkFinished(@NonNull List<IPPortPair> unreachable, @NonNull List<IPPortPair> reachable);
public final void checkProgress(IPPortPair server, boolean reachable){ public final void checkProgress(@NonNull IPPortPair server, boolean reachable){
if(server == null)return; if(server == null || server.isEmpty())return;
if(!reachable)unreachable.add(server); if(!reachable)unreachable.add(server);
else this.reachable.add(server); else this.reachable.add(server);
if(this.unreachable.size() + this.reachable.size() >= servers)checkFinished(unreachable, this.reachable); if(this.unreachable.size() + this.reachable.size() >= servers)checkFinished(this.unreachable, this.reachable);
} }
void setServers(int servers){ void setServers(int servers){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment