summaryrefslogtreecommitdiff
path: root/plugins/elf/python
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/elf/python')
-rw-r--r--plugins/elf/python/format.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/elf/python/format.c b/plugins/elf/python/format.c
index 0319ba9..87b590b 100644
--- a/plugins/elf/python/format.c
+++ b/plugins/elf/python/format.c
@@ -82,13 +82,20 @@ static PyObject *py_elf_format_new(PyTypeObject *type, PyObject *args, PyObject
content = G_BIN_CONTENT(pygobject_get(content_obj));
format = g_elf_format_new(content);
- assert(format != NULL);
- result = pygobject_new(G_OBJECT(format));
+ if (format == NULL)
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
- g_object_unref(format);
+ else
+ {
+ result = pygobject_new(G_OBJECT(format));
+ g_object_unref(format);
+ }
- return (PyObject *)result;
+ return result;
}