add an upstream crash fix
[alioth/musescore.git] / debian / patches / backports / plugin-parent.diff
1 Origin: upstream, commit:f1369d3a5ae1beca7a01fd06719ffe93f39cfb47
2 Author: Dmitri Ovodok <dmitrio95@yandex.ru>
3 Description: Plugins: fix a crash on getting element's parent if parent is null
4
5 --- a/mscore/plugin/api/elements.cpp
6 +++ b/mscore/plugin/api/elements.cpp
7 @@ -123,6 +123,9 @@ void Chord::remove(Ms::PluginAPI::Elemen
8  
9  Element* wrap(Ms::Element* e, Ownership own)
10        {
11 +      if (!e)
12 +            return nullptr;
13 +
14        using Ms::ElementType;
15        switch(e->type()) {
16              case ElementType::NOTE:
17 --- a/mscore/plugin/api/scoreelement.cpp
18 +++ b/mscore/plugin/api/scoreelement.cpp
19 @@ -105,6 +105,8 @@ void ScoreElement::set(Ms::Pid pid, QVar
20  
21  ScoreElement* wrap(Ms::ScoreElement* se, Ownership own)
22        {
23 +      if (!se)
24 +            return nullptr;
25        if (se->isElement())
26              return wrap(toElement(se), own);
27