Bug 465512

Summary: Python search layer causes instant crash
Product: [Applications] krita Reporter: keyth_qcfx2 <keyth2363214>
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: halla
Priority: NOR    
Version First Reported In: 5.1.5   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description keyth_qcfx2 2023-02-09 17:05:00 UTC
SUMMARY
Searching for a layer name that is not present on the layer stack causes instant crash

STEPS TO REPRODUCE
1. open a new document
2. run the following code ( code searches for non existent layer )

CODE
"""
from krita import *
node_name = "cenas"
ad = Krita.instance().activeDocument()
node_i = ad.nodeByName( node_name )
ad.setActiveNode( node_i )
"""

OBSERVED RESULT
Krita instant crash

EXPECTED RESULT
no Krita crash with a return of None

SOFTWARE/OS VERSIONS
Windows: 10
Qt Version: 5.12.12

ADDITIONAL INFORMATION
Comment 1 Halla Rempt 2023-03-06 11:49:38 UTC
Git commit 519fa7dd2b976d52e5aa3d386c2ff172383aa63c by Halla Rempt.
Committed on 06/03/2023 at 11:48.
Pushed by rempt into branch 'master'.

setActiveNode: check Node parameter is not null

M  +5    -0    libs/libkis/Document.cpp

https://invent.kde.org/graphics/krita/commit/519fa7dd2b976d52e5aa3d386c2ff172383aa63c