Commit c13f7a4c authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix static_cast in KisPaintopBox

Let's not assume that we will always get a KisPaintop::KoResource here,
so use dynamic_cast and check the result.
parent 331bbdf8
......@@ -284,15 +284,15 @@ void KisPaintopBox::updatePaintops(const KoColorSpace* colorSpace)
void KisPaintopBox::resourceSelected(KoResource* resource)
{
KisPaintOpPreset* preset = static_cast<KisPaintOpPreset*>(resource);
dbgUI << "preset " << preset->name() << "selected";
if(!preset->settings()->isLoadable())
return;
setCurrentPaintop(preset->paintOp(), preset->clone());
m_presetsPopup->setPresetImage(preset->image());
m_presetsPopup->resourceSelected(resource);
KisPaintOpPreset* preset = dynamic_cast<KisPaintOpPreset*>(resource);
if (preset) {
if(!preset->settings()->isLoadable())
return;
setCurrentPaintop(preset->paintOp(), preset->clone());
m_presetsPopup->setPresetImage(preset->image());
m_presetsPopup->resourceSelected(resource);
}
}
QPixmap KisPaintopBox::paintopPixmap(const KoID& paintop)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment