blob: 0ecb4bd113bcede73a7d9f2279946d3a7d759cff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
diff --git a/gidocgen/gir/parser.py b/gidocgen/gir/parser.py
index e62835d..7ee60fa 100644
--- a/gidocgen/gir/parser.py
+++ b/gidocgen/gir/parser.py
@@ -288,7 +288,11 @@ class GirParser:
content = child.text or ""
- return ast.Doc(content=content, filename=child.attrib['filename'], line=int(child.attrib['line']))
+ return ast.Doc(
+ content=content,
+ filename=child.attrib.get('filename', ''),
+ line=int(child.attrib.get('line', 0)),
+ )
def _maybe_parse_source_position(self, node: ET.Element) -> T.Optional[ast.SourcePosition]:
child = node.find('core:source-position', GI_NAMESPACES)
|