summaryrefslogtreecommitdiffstats
path: root/qom/object_interfaces.c
diff options
context:
space:
mode:
authorKevin Wolf2021-02-22 15:29:27 +0100
committerKevin Wolf2021-03-19 10:17:14 +0100
commit98c43b7b8b7504099760383fc802d18bc8b18f48 (patch)
tree7f6609ab3354ffee37b30c063a3b3391b04b6c05 /qom/object_interfaces.c
parentqapi/qom: QAPIfy object-add (diff)
downloadqemu-98c43b7b8b7504099760383fc802d18bc8b18f48.tar.gz
qemu-98c43b7b8b7504099760383fc802d18bc8b18f48.tar.xz
qemu-98c43b7b8b7504099760383fc802d18bc8b18f48.zip
qom: Make "object" QemuOptsList optional
This code is going away anyway, but for a few more commits, we'll be in a state where some binaries still use QemuOpts and others don't. If the "object" QemuOptsList doesn't even exist, we don't have to remove (or fail to remove, and therefore abort) a user creatable object from it. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qom/object_interfaces.c')
-rw-r--r--qom/object_interfaces.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index 7661270b98..d4df2334b7 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -299,6 +299,7 @@ void user_creatable_print_help_from_qdict(QDict *args)
bool user_creatable_del(const char *id, Error **errp)
{
+ QemuOptsList *opts_list;
Object *container;
Object *obj;
@@ -318,8 +319,10 @@ bool user_creatable_del(const char *id, Error **errp)
* if object was defined on the command-line, remove its corresponding
* option group entry
*/
- qemu_opts_del(qemu_opts_find(qemu_find_opts_err("object", &error_abort),
- id));
+ opts_list = qemu_find_opts_err("object", NULL);
+ if (opts_list) {
+ qemu_opts_del(qemu_opts_find(opts_list, id));
+ }
object_unparent(obj);
return true;