Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Fix crash when trying to export non-existing palette
Dmitry Kazakov23d555e5912e
diff --git a/libs/widgets/KisPaletteChooser.cpp b/libs/widgets/KisPaletteChooser.cppindex 44ba5c8123..0d45c4cae9 100644--- a/libs/widgets/KisPaletteChooser.cpp+++ b/libs/widgets/KisPaletteChooser.cpp@@ -106,7 +106,9 @@ void KisPaletteChooser::slotExport()m_d->itemChooser->setCurrentItem(0);}KoColorSetSP palette = m_d->itemChooser->currentResource().dynamicCast<KoColorSet>();- Q_EMIT sigExportPalette(palette);+ if (palette) {+ Q_EMIT sigExportPalette(palette);+ }}/************************* KisPaletteChooserPrivate **********************/diff --git a/plugins/dockers/palettedocker/palettedocker_dock.cpp b/plugins/dockers/palettedocker/palettedocker_dock.cppindex a804bf9635..9b492747dd 100644--- a/plugins/dockers/palettedocker/palettedocker_dock.cpp+++ b/plugins/dockers/palettedocker/palettedocker_dock.cpp@@ -223,6 +223,8 @@ void PaletteDockerDock::slotImportPalette()void PaletteDockerDock::slotExportPalette(KoColorSetSP palette){+ KIS_SAFE_ASSERT_RECOVER_RETURN(palette);+KoFileDialog dialog(this, KoFileDialog::SaveFile, "Save Palette");dialog.setCaption(i18n("Export Palette"));dialog.setDefaultDir(palette->filename());