fixed nullptr

This commit is contained in:
arvid schröder 2023-01-25 00:07:44 +01:00
parent da1f885e9a
commit 9dd5878f31

View file

@ -122,7 +122,7 @@ Color CloudShader::transparency(const Scene &scene, const Ray &ray, float maxLen
cloudRay.primitive = nullptr;
// Get out of cloud primitive first
if (!ray.primitive->intersect(cloudRay) || cloudRay.length == INFINITY || cloudRay.length <= 0)
if (ray.primitive != nullptr && !ray.primitive->intersect(cloudRay) || cloudRay.length == INFINITY || cloudRay.length <= 0)
{
// Something went wrong
return Color(1, 1, 1);