Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add protection for nulltpr crash in CameraZoomPlugin #79

Merged

Conversation

Ryanf55
Copy link
Contributor

@Ryanf55 Ryanf55 commented Jan 22, 2024

Fixes #77

Make sure to hit Play in gazebo for the image topic to show up!

image

@Ryanf55 Ryanf55 force-pushed the bugfix/camera-initialize-nullptr-crash branch from 966cfe1 to 5a8edcc Compare January 22, 2024 22:44
@Ryanf55 Ryanf55 changed the title Add protection for nulltpr crash Add protection for nulltpr crash in CameraZoomPlugin Jan 22, 2024
Copy link
Collaborator

@srmainwaring srmainwaring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor style change and question if we can re-use existing check block?

src/CameraZoomPlugin.cc Outdated Show resolved Hide resolved
Comment on lines 173 to 177
if (!this->scene)
{
this->scene = rendering::sceneFromFirstRenderEngine();
if (!this->scene) {
gzerr << "Failed to get scene in InitialiseCamera()!\n";
return;
}

}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add the !this->scene check to the block that checks for initialisation?

  if (this->scene == nullptr ||
      !this->scene->IsInitialized() ||
      this->scene->SensorCount() == 0)
  {

@Ryanf55 Ryanf55 mentioned this pull request Jan 23, 2024
@Ryanf55 Ryanf55 force-pushed the bugfix/camera-initialize-nullptr-crash branch from 5b3af1b to 7f876a1 Compare January 23, 2024 06:00
@srmainwaring srmainwaring changed the base branch from ros2 to main January 25, 2024 08:56
@srmainwaring
Copy link
Collaborator

@Ryanf55 - changed base to main. I'll resolve the conflicts and update.

Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
@srmainwaring srmainwaring self-assigned this Jan 25, 2024
@srmainwaring srmainwaring added the bug Something isn't working label Jan 25, 2024
@srmainwaring srmainwaring force-pushed the bugfix/camera-initialize-nullptr-crash branch from 7f876a1 to 071163e Compare January 25, 2024 09:09
@srmainwaring srmainwaring merged commit e0cf84c into ArduPilot:main Jan 25, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Runtime Crash with protobuf on gimbal.sdf launch (Ubuntu 22, GZ Harmonic and humble)
2 participants