Commit 76165427 authored by Halla Rempt's avatar Halla Rempt
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
parent e2fb1409
Pipeline #212734 passed with stage
in 75 minutes and 33 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;
}
/******************************************************************/
......
......@@ -318,8 +318,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;
......@@ -329,8 +330,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);
}
});
}
......
......@@ -89,9 +89,7 @@ class Debugger(bdb.Bdb):
while True:
if self.applicationq.empty():
# 'yield from' is not available in Python 2.
for i in asyncio.sleep(0.3):
yield i
yield from asyncio.sleep(0.3)
else:
while not self.applicationq.empty():
self.application_data.update(self.applicationq.get())
......
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