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
dialog.show();
((MainFragment)currentFragment()).checkDNSReachability(new MainFragment.DNSReachabilityCallback() {
@Override
public void checkFinished(@NonNull List<IPPortPair> unreachable, List<IPPortPair> reachable) {
public void checkFinished(@NonNull List<IPPortPair> unreachable, @NonNull List<IPPortPair> reachable) {
dialog.dismiss();
if(unreachable.size() == 0){
MainActivity.this.runOnUiThread(new Runnable() {
......
......@@ -496,11 +496,11 @@ public class MainFragment extends Fragment {
public abstract void checkFinished(@NonNull List<IPPortPair> unreachable, @NonNull List<IPPortPair> reachable);
public final void checkProgress(IPPortPair server, boolean reachable){
if(server == null)return;
public final void checkProgress(@NonNull IPPortPair server, boolean reachable){
if(server == null || server.isEmpty())return;
if(!reachable)unreachable.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){
......
Markdown is supported
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