]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
snapshot: Allow NULL to virDomainSnapshotObjGetDef
authorEric Blake <eblake@redhat.com>
Wed, 27 Mar 2019 09:24:38 +0000 (04:24 -0500)
committerEric Blake <eblake@redhat.com>
Wed, 27 Mar 2019 13:14:42 +0000 (08:14 -0500)
Doing so can simplify some callers.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/snapshot_conf.c
src/conf/virdomainsnapshotobjlist.h

index 4ce120451ed1a24cd23b779b90440cd4586cb24b..8e4f3d9410f8b8ba20ea6d7a0728c489bc19e351 100644 (file)
@@ -967,7 +967,7 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain,
     }
 
     other = virDomainSnapshotFindByName(vm->snapshots, def->common.name);
-    otherdef = other ? virDomainSnapshotObjGetDef(other) : NULL;
+    otherdef = virDomainSnapshotObjGetDef(other);
     check_if_stolen = other && otherdef->common.dom;
     if (virDomainSnapshotRedefineValidate(def, domain->uuid, other, xmlopt,
                                           flags) < 0) {
index b83f7a4ba919fa4162f0acd79e692cdf4987bcd4..12b574b4ff6604c4570d8c360133cd9c2dadcb05 100644 (file)
@@ -87,7 +87,7 @@ int virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
 static inline virDomainSnapshotDefPtr
 virDomainSnapshotObjGetDef(virDomainMomentObjPtr obj)
 {
-    return (virDomainSnapshotDefPtr) obj->def;
+    return obj ? (virDomainSnapshotDefPtr) obj->def : NULL;
 }
 
 #endif /* LIBVIRT_VIRDOMAINSNAPSHOTOBJLIST_H */