Doing so can simplify some callers. Signed-off-by: Eric Blake <eblake@xxxxxxxxxx> --- src/conf/virdomainsnapshotobjlist.h | 2 +- src/conf/snapshot_conf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/virdomainsnapshotobjlist.h b/src/conf/virdomainsnapshotobjlist.h index b83f7a4ba9..12b574b4ff 100644 --- a/src/conf/virdomainsnapshotobjlist.h +++ b/src/conf/virdomainsnapshotobjlist.h @@ -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 */ diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 4ce120451e..8e4f3d9410 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -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) { -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list