diff --git a/VoidLink/Network/DiscoveryWorker.m b/VoidLink/Network/DiscoveryWorker.m index 8e578817..8a8c315f 100644 --- a/VoidLink/Network/DiscoveryWorker.m +++ b/VoidLink/Network/DiscoveryWorker.m @@ -46,16 +46,17 @@ static const float POLL_RATE = 2.0f; // Poll every 2 seconds if (_host.localAddress != nil) { [array addObject:_host.localAddress]; } - if(_host.activeAddressPool.count>0){ - for(NSString* address in _host.activeAddressPool){ - if([address containsString:@":"]) break; - [array addObject:address]; - } - for(NSString* address in _host.activeAddressPool){ - if(![address containsString:@":"]) break; - [array addObject:address]; - } + + NSArray *poolSnapshot = [_host.activeAddressPool copy]; + for (NSString *address in poolSnapshot) { + if ([address containsString:@":"]) break; + [array addObject:address]; } + for (NSString *address in poolSnapshot) { + if (![address containsString:@":"]) break; + [array addObject:address]; + } + if (_host.address != nil) { [array addObject:_host.address]; } diff --git a/VoidLink/ViewControllers/MainFrameViewController.m b/VoidLink/ViewControllers/MainFrameViewController.m index 520368a6..7deba677 100644 --- a/VoidLink/ViewControllers/MainFrameViewController.m +++ b/VoidLink/ViewControllers/MainFrameViewController.m @@ -604,7 +604,7 @@ static NSMutableSet* hostList; Log(LOG_D, @"Long clicked host: %@", host.name); NSString* message; - NSString* hostAddress = [host.activeAddress componentsSeparatedByString:@":"].firstObject; + NSString* hostAddress = [Utils addressPortStringToAddress:host.activeAddress]; switch (host.state) { case StateOffline: