https://bugs.kde.org/show_bug.cgi?id=465799
Bug ID: 465799
Summary: segmentation fault if last used exporter disappears
Classification: Applications
Product: ghostwriter
Version: unspecified
Platform: Archlinux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
The ghostwriter::AppSettings constructor will call `setOptions()` on an
Exporter nullptr if
`ExporterFactory::instance()->exporterByName(exporterName);` returns nullptr.
The following changes seems to fix it:
diff --git a/src/appsettings.cpp b/src/appsettings.cpp
index 5500108..38ca677 100644
--- a/src/appsettings.cpp
+++ b/src/appsettings.cpp
@@ -774,10 +774,11 @@ AppSettings::AppSettings()
QString exporterName =
appSettings.value(GW_LAST_USED_EXPORTER_KEY).toString();
d->currentHtmlExporter =
ExporterFactory::instance()->exporterByName(exporterName);
-
d->currentHtmlExporter->setOptions(appSettings.value(GW_LAST_USED_EXPORTER_PARAMS_KEY).toString());
if (nullptr == d->currentHtmlExporter) {
d->currentHtmlExporter =
ExporterFactory::instance()->htmlExporters().first();
+ } else {
+
d->currentHtmlExporter->setOptions(appSettings.value(GW_LAST_USED_EXPORTER_PARAMS_KEY).toString());
}
}
--
You are receiving this mail because:
You are watching all bug changes.