Commit 8fec4a66 authored by Halla Rempt's avatar Halla Rempt Committed by Amy spark
Browse files

Check pointer before dereferencing

Fixes crash on selecting and cutting/copying in a new document. Not
every paint device has a frameinterface.

BUG:457475
BUG:460954

(cherry picked from commit 76165427)
parent a750bb6f
Pipeline #254909 passed with stage
in 40 minutes and 46 seconds
......@@ -2207,7 +2207,10 @@ bool KisPaintDevice::burnKeyframe(int frameID)
bool KisPaintDevice::burnKeyframe()
{
return burnKeyframe(m_d->framesInterface->currentFrameId());
if (m_d->framesInterface) {
return burnKeyframe(m_d->framesInterface->currentFrameId());
}
return true;
}
/******************************************************************/
......
......@@ -320,8 +320,9 @@ void KisCutCopyActionFactory::run(bool willCut, bool makeSharpClip, KisViewManag
Q_FOREACH (KisNodeSP node, nodes) {
KisLayerUtils::recursiveApplyNodes(node, [image, view, makeSharpClip] (KisNodeSP node) {
KisPaintDeviceSP dev = node->paintDevice();
dev->burnKeyframe();
if (node && node->paintDevice()) {
node->paintDevice()->burnKeyframe();
}
KisTimeSpan range;
......@@ -331,8 +332,8 @@ void KisCutCopyActionFactory::run(bool willCut, bool makeSharpClip, KisViewManag
range = channel->affectedFrames(currentTime);
}
if (dev && !node->inherits("KisMask")) {
ActionHelper::trimDevice(view, dev, makeSharpClip, range);
if (node && node->paintDevice() && !node->inherits("KisMask")) {
ActionHelper::trimDevice(view, node->paintDevice(), makeSharpClip, range);
}
});
}
......
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