Skip to content

Commit

Permalink
Add protection for nulltpr crash
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Friedman <[email protected]>
  • Loading branch information
Ryanf55 committed Jan 22, 2024
1 parent 1caa507 commit 5a8edcc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/CameraZoomPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,19 @@ void CameraZoomPlugin::Impl::OnZoom(const msgs::Double &_msg)
void CameraZoomPlugin::Impl::InitialiseCamera()
{
// Wait for render engine to be available.
if (rendering::loadedEngines().empty())
if (rendering::loadedEngines().empty()) {
return;
}

// Get scene.
if (!this->scene)
{
this->scene = rendering::sceneFromFirstRenderEngine();
if (!this->scene) {
gzerr << "Failed to get scene in InitialiseCamera()!\n";
return;
}

}

// Return if scene not ready or no sensors available.
Expand Down

0 comments on commit 5a8edcc

Please sign in to comment.