Add explicit checks whenever we are accessing another scene graph node (closes #1831)

This commit is contained in:
Alexander Bock
2022-02-20 19:17:06 +01:00
parent 797a81dbe6
commit a6f048e342
12 changed files with 80 additions and 55 deletions

View File

@@ -2033,6 +2033,14 @@ void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& prog
SceneGraphNode* casterNode =
global::renderEngine->scene()->sceneGraphNode(caster);
if ((sourceNode == nullptr) || (casterNode == nullptr)) {
LERRORC(
"Renderableglobe",
"Invalid scenegraph node for the shadow's caster or shadow's receiver."
);
return;
}
const double sourceRadiusScale = std::max(
glm::compMax(sourceNode->scale()),
1.0
@@ -2043,14 +2051,6 @@ void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& prog
1.0
);
if ((sourceNode == nullptr) || (casterNode == nullptr)) {
LERRORC(
"Renderableglobe",
"Invalid scenegraph node for the shadow's caster or shadow's receiver."
);
return;
}
// First we determine if the caster is shadowing the current planet (all
// calculations in World Coordinates):
const glm::dvec3 planetCasterVec = casterPos - data.modelTransform.translation;