Fix crash in Recolor Marker dialog reset button
Closes #5976 (closed)
Crash location: src/ui/widget/recolor-art.cpp
Root Cause
The onResetClicked() function dereferenced pointers without validation:
- Called
get_selected()and used the result without checking if a valid item was selected - Cast to ColorItem without null-checking before dereferencing
Solution
Added safety checks before pointer dereferencing, following the pattern already used in onRowActivated() (line 217-224):
- Check if index >= 0 (valid selection exists)
- Check if color_item != nullptr (successful cast)
- Early return if either check fails
This prevents the crash while maintaining the intended reset functionality when a valid color is selected.
After the fix: