Patchwork [2/7] allow passing NULL to qobject_type

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 17, 2009, 7:55 a.m.
Message ID <1255766136-3028-3-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/36291/
State New
Headers show

Comments

Paolo Bonzini - Oct. 17, 2009, 7:55 a.m.
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qobject.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/qobject.h b/qobject.h
index 4cc9287..200644d 100644
--- a/qobject.h
+++ b/qobject.h
@@ -102,6 +102,8 @@  static inline void qobject_decref(QObject *obj)
  */
 static inline qtype_code qobject_type(const QObject *obj)
 {
+    if (!obj)
+        return QTYPE_NONE;
     assert(obj->type != NULL);
     return obj->type->code;
 }