Fix crash on incomplete Adw.AlertDialog response

This commit is contained in:
James Westman 2025-05-03 19:51:00 -05:00
parent 6bef9a39dd
commit 684ed7dc02
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
2 changed files with 6 additions and 2 deletions

View file

@ -80,11 +80,14 @@ class ExtAdwResponseDialogResponse(AstNode):
return not any(flag.flag == "disabled" for flag in self.flags)
@property
def value(self) -> StringValue:
def value(self) -> T.Optional[StringValue]:
return self.children[0]
@property
def document_symbol(self) -> DocumentSymbol:
def document_symbol(self) -> T.Optional[DocumentSymbol]:
if self.value is None:
return None
return DocumentSymbol(
self.id,
SymbolKind.Field,

View file

@ -364,6 +364,7 @@ class XmlOutput(OutputFormat):
elif isinstance(extension, ExtAdwResponseDialog):
xml.start_tag("responses")
for response in extension.responses:
assert response.value is not None
xml.start_tag(
"response",
id=response.id,