summaryrefslogtreecommitdiff
path: root/plugins/kaitai/python
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-10-08 08:49:59 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-10-08 08:57:45 (GMT)
commitcc43f73bbbdfd1cb6d7129c82e2d221181a3cac3 (patch)
tree191999d6d2b9799c97864890d5c6f5510e5966f4 /plugins/kaitai/python
parent3ab50c0b628b6b6f8345b458a919ad9dae9f0cd9 (diff)
Handle anonymous item in Kaitai definitions.
Diffstat (limited to 'plugins/kaitai/python')
-rw-r--r--plugins/kaitai/python/parsers/attribute.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/kaitai/python/parsers/attribute.c b/plugins/kaitai/python/parsers/attribute.c
index 638e23e..c2f3db6 100644
--- a/plugins/kaitai/python/parsers/attribute.c
+++ b/plugins/kaitai/python/parsers/attribute.c
@@ -149,9 +149,14 @@ static PyObject *py_kaitai_attribute_get_raw_id(PyObject *self, void *closure)
attrib = G_KAITAI_ATTRIBUTE(pygobject_get(self));
value = g_kaitai_attribute_get_raw_id(attrib);
- assert(value != NULL);
- result = PyUnicode_FromString(value);
+ if (value == NULL)
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+ else
+ result = PyUnicode_FromString(value);
return result;