[Bf-blender-cvs] [c9c4802c1c2] master: Fix T85671: color management crash with Medium Contrast look

Brecht Van Lommel noreply at git.blender.org
Tue Feb 16 23:29:14 CET 2021


Commit: c9c4802c1c26d1125d9bb41ff9187b61e167cc42
Author: Brecht Van Lommel
Date:   Tue Feb 16 22:37:27 2021 +0100
Branches: master
https://developer.blender.org/rBc9c4802c1c26d1125d9bb41ff9187b61e167cc42

Fix T85671: color management crash with Medium Contrast look

===================================================================

M	intern/opencolorio/ocio_impl.cc

===================================================================

diff --git a/intern/opencolorio/ocio_impl.cc b/intern/opencolorio/ocio_impl.cc
index 69a8d8b17af..c4d7a0c4fe9 100644
--- a/intern/opencolorio/ocio_impl.cc
+++ b/intern/opencolorio/ocio_impl.cc
@@ -682,19 +682,25 @@ OCIO_ConstProcessorRcPtr *OCIOImpl::createDisplayProcessor(OCIO_ConstConfigRcPtr
   }
 
   /* Add look transform. */
-  const bool use_look = (strlen(look) != 0);
+  bool use_look = (look != nullptr && look[0] != 0);
   if (use_look) {
     const char *look_output = LookTransform::GetLooksResultColorSpace(
         config, config->getCurrentContext(), look);
 
-    LookTransformRcPtr lt = LookTransform::Create();
-    lt->setSrc(input);
-    lt->setDst(look_output);
-    lt->setLooks(look);
-    group->appendTransform(lt);
+    if (look_output != nullptr && look_output[0] != 0) {
+      LookTransformRcPtr lt = LookTransform::Create();
+      lt->setSrc(input);
+      lt->setDst(look_output);
+      lt->setLooks(look);
+      group->appendTransform(lt);
 
-    /* Make further transforms aware of the color space change. */
-    input = look_output;
+      /* Make further transforms aware of the color space change. */
+      input = look_output;
+    }
+    else {
+      /* For empty looks, no output color space is returned. */
+      use_look = false;
+    }
   }
 
   /* Add view and display transform. */



More information about the Bf-blender-cvs mailing list