diff --git a/apport/report.py b/apport/report.py index c828c8b63..28cfb79c4 100644 --- a/apport/report.py +++ b/apport/report.py @@ -1620,8 +1620,9 @@ def standard_title(self) -> str | None: # package problem if self.get("ProblemType") == "Package" and "Package" in self: title = f"package {self['Package']} failed to install/upgrade" - if self.get("ErrorMessage"): - title += ": " + self["ErrorMessage"].splitlines()[-1] + error_message = self.get("ErrorMessage") + if error_message and isinstance(error_message, str): + title += ": " + error_message.splitlines()[-1] return title diff --git a/data/general-hooks/generic.py b/data/general-hooks/generic.py index 879fd3f6f..ddf567869 100644 --- a/data/general-hooks/generic.py +++ b/data/general-hooks/generic.py @@ -104,8 +104,10 @@ def add_info(report: ProblemReport, ui: apport.hook_ui.HookUI) -> None: " which the crashed program expected to use." ) # filter out package install failures due to a segfault + error_message = report.get("ErrorMessage") if ( - "Segmentation fault" in report.get("ErrorMessage", "") + isinstance(error_message, str) + and "Segmentation fault" in error_message and report["ProblemType"] == "Package" ): report["UnreportableReason"] = (