Fix errors saving PCs that were discovered via mDNS

This commit is contained in:
Cameron Gutman
2018-05-28 13:19:49 -07:00
parent 85f81ca8c1
commit 1842a11f56
5 changed files with 59 additions and 13 deletions
+15 -4
View File
@@ -44,10 +44,21 @@
}
- (void) propagateChangesToParent:(Host*)parentHost {
parentHost.address = self.address;
parentHost.externalAddress = self.externalAddress;
parentHost.localAddress = self.localAddress;
parentHost.mac = self.mac;
// Avoid overwriting existing data with nil if
// we don't have everything populated in the temporary
// host.
if (self.address != nil) {
parentHost.address = self.address;
}
if (self.externalAddress != nil) {
parentHost.externalAddress = self.externalAddress;
}
if (self.localAddress != nil) {
parentHost.localAddress = self.localAddress;
}
if (self.mac != nil) {
parentHost.mac = self.mac;
}
parentHost.name = self.name;
parentHost.uuid = self.uuid;
parentHost.pairState = [NSNumber numberWithInt:self.pairState];