resources: nspawn: Don't panic if one svc is nil

Not sure why one of them was nil, but this prevents the panic.
This commit is contained in:
James Shubin
2018-02-06 05:38:01 -05:00
parent 3af7e815d0
commit 5f80c1ac2a

View File

@@ -339,9 +339,15 @@ func (obj *NspawnRes) Compare(r Res) bool {
return false
}
// TODO: why is res.svc ever nil?
if (obj.svc == nil) != (res.svc == nil) { // xor
return false
}
if obj.svc != nil && res.svc != nil {
if !obj.svc.Compare(res.svc) {
return false
}
}
return true
}