Merge pull request #294 from shadeops/DiffuseAreaLight_nullptr_fix

Fix nullptr access reported in issue #293
This commit is contained in:
Matt Pharr 2022-08-31 15:51:57 -07:00 • committed by GitHub
commit d4f5a4a43f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -916,13 +916,9 @@ DiffuseAreaLight *DiffuseAreaLight::Create(const Transform &renderFromLight,
// radiance such that the user-defined power will be the actual power
// emitted by the light.
Float k_e = 1;
// Get the appropriate luminance vector from the image colour space
RGB lum = imageColorSpace->LuminanceVector();
// we need to know which channels correspond to R, G and B
// we know that the channelDesc is valid as we would have exited in the
// block above otherwise
ImageChannelDesc channelDesc = image.GetChannelDesc({"R", "G", "B"});
if (image) {
// Get the appropriate luminance vector from the image colour space
RGB lum = imageColorSpace->LuminanceVector();
k_e = 0;
// Assume no distortion in the mapping, FWIW...
for (int y = 0; y < image.Resolution().y; ++y)