Prevent crash when color management is turned off #111144

Merged
Sybren A. Stüvel merged 1 commits from dr.sybren/blender:pr/colorspace-prevent-crash into main 2023-08-17 10:21:16 +02:00

1 Commits

Author SHA1 Message Date
Sybren A. Stüvel 1299cd6117 Prevent crash when color management is turned off
Prevent a segmentation fault when the viewport is set to 'Material Preview'
mode, drawing textures, and Blender built with `WITH_OPENCOLORIO=OFF`.

Most `IMB_colormanagement_...` functions assume that the `colorspace`
pointer can be `nullptr`, but the internal function
`colormanage_ensure_srgb_scene_linear_info()` does not, causing a crash.

Since this check can be done in multiple places, I picked one that seems
consistent with the rest of the code.
2023-08-15 17:11:10 +02:00