diff --git a/Gui/KnobUndoCommand.cpp b/Gui/KnobUndoCommand.cpp index 179c84a60b..75e67544dd 100644 --- a/Gui/KnobUndoCommand.cpp +++ b/Gui/KnobUndoCommand.cpp @@ -555,7 +555,10 @@ RestoreDefaultsCommand::undo() std::list times; KnobIPtr first = _knobs.front().lock(); KnobHolder* holder = first ? first->getHolder() : nullptr; - AppInstancePtr app = holder ? holder->getApp() : nullptr; + AppInstancePtr app; + if (holder) { + app = holder->getApp(); + } assert(app); std::list::iterator itClone = _clones.begin(); for (std::list::const_iterator it = _knobs.begin(); it != _knobs.end(); ++it, ++itClone) { @@ -602,7 +605,7 @@ RestoreDefaultsCommand::redo() { std::list times; KnobIPtr first = _knobs.front().lock(); - AppInstancePtr app = nullptr; + AppInstancePtr app; KnobHolder* holder = first ? first->getHolder() : nullptr; EffectInstance* isEffect = dynamic_cast(holder);