[gobject-introspection/issue-252] Do not bail out when parsing GIR files without doc positions



commit b20b71948e4c80a0d89f10bb2842f81c38efea34
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sat Dec 29 19:43:18 2018 +0000

    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

 giscanner/girparser.py | 4 ++--
 1 file 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:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]