Commit 8868c764 authored by Lukáš Tvrdý's avatar Lukáš Tvrdý
Browse files

Fix crash when preset is invalid

o sometimes presets might be old or corrupted and does not contain
  defintion for KisBrush (e.g. current default preset for spray )
  In that case use the KisBrush definition set by brush editor
  GUI defaults.

o fixes crash when you start krita, select spray brush,
  uncheck "Spray shapes", paint, crash

CCBUG:291441
parent a26ff962
......@@ -29,7 +29,7 @@ void KisBrushOption::writeOptionSetting(KisPropertiesConfiguration* setting) con
{
if(!m_brush)
return;
QDomDocument d;
QDomElement e = d.createElement( "Brush" );
m_brush->toXML( d, e );
......@@ -43,10 +43,12 @@ void KisBrushOption::writeOptionSetting(KisPropertiesConfiguration* setting) con
void KisBrushOption::readOptionSetting(const KisPropertiesConfiguration* setting)
{
QString brushDefinition = setting->getString("brush_definition");
QDomDocument d;
d.setContent( brushDefinition, false );
QDomElement e = d.firstChildElement("Brush" );
m_brush = KisBrush::fromXML( e );
if (!brushDefinition.isEmpty()) {
QDomDocument d;
d.setContent( brushDefinition, false );
QDomElement e = d.firstChildElement("Brush" );
m_brush = KisBrush::fromXML( e );
}
}
KisBrushSP KisBrushOption::brush() const
......
Supports Markdown
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