diff --git a/qom/object.c b/qom/object.c index dd53d242a..75e6aac15 100644 --- a/qom/object.c +++ b/qom/object.c @@ -453,6 +453,11 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class, TypeImpl *type = class->type; ObjectClass *ret = NULL; + if (!target_type) { + /* target class type unknown, so fail the cast */ + return NULL; + } + if (type->class->interfaces && type_is_ancestor(target_type, type_interface)) { int found = 0;