From 3eeba58b7d59810eba5154f186210b08b107bccc Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 4 Apr 2012 21:40:46 +0200 Subject: [PATCH] Fix crash when dropping effect from effects list to effect stack --- src/clipitem.cpp | 1 + src/effectslist.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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(); } -- 2.39.2