[go: up one dir, main page]

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):

  1. Check if index >= 0 (valid selection exists)
  2. Check if color_item != nullptr (successful cast)
  3. 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:

Screencast from 2025-11-14 02-35-04.webm

Merge request reports

Loading