aboutsummaryrefslogtreecommitdiff
path: root/qom
diff options
context:
space:
mode:
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c
index dd53d242a5..75e6aac15f 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;