summaryrefslogtreecommitdiff
path: root/plugins/elf/python/format.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-05-07 15:00:14 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-05-07 15:00:14 (GMT)
commit83da8ea946dc50941838ec8b3951108f5e16642e (patch)
tree06d30655b95e856f2def3da0fab24067271de8b0 /plugins/elf/python/format.c
parentc136e2c4c1ad02ea2e363fbe71ce54c6255793e2 (diff)
Described binary formats and improved their loading.
Diffstat (limited to 'plugins/elf/python/format.c')
-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;
}