Fix #117526: Crash when Changing Color Palette in Edit Mode #117544

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:117526 into main 2024-01-26 16:22:01 +01:00

1 Commits

Author SHA1 Message Date
Philipp Oeser da8bf9238a Fix #117526: Crash When Changing Color Palette in Edit Mode
By default, Color Palettes are only drawn in the UI in the context of
**painting**.
UI button code then tries to update an appropriate brush from edits to
the palette.

So a valid `Paint` and `Brush` were assumed. This is not a problem for
objectmode (because `BKE_paint_get_active_from_context` then defaults to
`ImagePaintSettings`'s `Paint`), but other modes dont guarantee this
(editmode only returns a valid `Paint` when uv sculpting).

In the report, a palette was created and displayed via python, making
changes in editmode would then crash.

Solve by checking we have a valid Paint in corresponding UI code to
begin with.

Similar to 9e82e48937 .
2024-01-26 13:53:11 +01:00