diff --git a/qemu/qobject/qlist.c b/qemu/qobject/qlist.c index 60ce805d..a54f9ffb 100644 --- a/qemu/qobject/qlist.c +++ b/qemu/qobject/qlist.c @@ -142,10 +142,9 @@ size_t qlist_size(const QList *qlist) */ QList *qobject_to_qlist(const QObject *obj) { - if (qobject_type(obj) != QTYPE_QLIST) { + if (!obj || qobject_type(obj) != QTYPE_QLIST) { return NULL; } - return container_of(obj, QList, base); }