From: Jean-Baptiste Mardelle Date: Wed, 4 Apr 2012 19:40:46 +0000 (+0200) Subject: Fix crash when dropping effect from effects list to effect stack X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;ds=sidebyside;h=3eeba58b7d59810eba5154f186210b08b107bccc;p=kdenlive Fix crash when dropping effect from effects list to effect stack --- diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 1f350225..04082138 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -1415,6 +1415,7 @@ EffectsParameterList ClipItem::addEffect(QDomElement effect, bool /*animate*/) int ix; QDomElement insertedEffect; if (!effect.hasAttribute("kdenlive_ix")) { + // effect dropped from effect list ix = effectsCounter(); } else ix = effect.attribute("kdenlive_ix").toInt(); if (!m_effectList.isEmpty() && ix <= m_effectList.count()) { diff --git a/src/effectslist.cpp b/src/effectslist.cpp index 2ceb0305..9d33f8e1 100644 --- a/src/effectslist.cpp +++ b/src/effectslist.cpp @@ -352,7 +352,7 @@ QDomElement EffectsList::insert(QDomElement effect) QDomNodeList effects = m_baseElement.childNodes(); int ix = effect.attribute("kdenlive_ix").toInt(); QDomElement result; - if (effect.hasAttribute("kdenlive_ix") && ix > effects.count()) { + if (ix <= 0 || ix > effects.count()) { ix = effects.count(); result = m_baseElement.appendChild(importNode(effect, true)).toElement(); }