summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2018-12-29 19:43:18 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2018-12-29 19:43:18 +0000
commitb20b71948e4c80a0d89f10bb2842f81c38efea34 (patch)
treefbd9a99f1b3141121c91926b0a2f659713d90a30
parent37a94c19cbb73a7fcb846b5aa9cfd1dae920c1ff (diff)
downloadgobject-introspection-b20b71948e4c80a0d89f10bb2842f81c38efea34.tar.gz
Do not bail out when parsing GIR files without doc positions
The position attributes on a <doc> element are not mandatory, so we should have some fallback value if they are missing. Fixes: #252
-rw-r--r--giscanner/girparser.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/giscanner/girparser.py b/giscanner/girparser.py
index 3bc4a6f4..5fa9f510 100644
--- a/giscanner/girparser.py
+++ b/giscanner/girparser.py
@@ -185,8 +185,8 @@ class GIRParser(object):
if doc is not None:
if doc.text:
obj.doc = doc.text
- obj.doc_position = Position(doc.attrib['filename'],
- doc.attrib['line'],
+ obj.doc_position = Position(doc.attrib.get('filename', '<unknown>'),
+ doc.attrib.get('line', None),
doc.attrib.get('column', None))
version = node.attrib.get('version')
if version: