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:
@@ -339,9 +339,15 @@ func (obj *NspawnRes) Compare(r Res) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if !obj.svc.Compare(res.svc) {
|
// TODO: why is res.svc ever nil?
|
||||||
|
if (obj.svc == nil) != (res.svc == nil) { // xor
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if obj.svc != nil && res.svc != nil {
|
||||||
|
if !obj.svc.Compare(res.svc) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user