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

Division by zero might occur in viewer.cpp #11233

Merged

Conversation

Tamir91
Copy link
Contributor

@Tamir91 Tamir91 commented Dec 19, 2022

Tracked on [LRS-570]
The division was surrounded by an "if" statement and "throw Exception" added.

@Tamir91 Tamir91 marked this pull request as draft December 19, 2022 12:57
@Tamir91 Tamir91 requested a review from Nir-Az December 19, 2022 14:03
@Nir-Az
Copy link
Collaborator

Nir-Az commented Dec 19, 2022

Why draft?

@Nir-Az
Copy link
Collaborator

Nir-Az commented Dec 19, 2022

There are 2 unrelated changes here, please split

@@ -2221,7 +2221,10 @@ namespace rs2
{
auto vf_profile = last_points.get_profile().as<video_stream_profile>();
// Non-linear correspondence customized for non-flat surface exploration
glPointSize(std::sqrt(viewer_rect.w / vf_profile.width()));
if (vf_profile.width() > 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to do something else on an error and to continue otherwise.

 if (vf_profile.width() <=  0)
       throw std::runtime_error("Profile width found equals 0 but must be greater than 0");

glPointSize(std::sqrt(viewer_rect.w / vf_profile.width()));

@Tamir91 Tamir91 force-pushed the bug/kw_division_by_zero_error_2 branch from 3214d44 to 2454acd Compare December 19, 2022 15:13
@Tamir91
Copy link
Contributor Author

Tamir91 commented Dec 19, 2022

There are 2 unrelated changes here, please split

Until a code not passed all tests it was in the draft...

@Tamir91
Copy link
Contributor Author

Tamir91 commented Dec 19, 2022

There are 2 unrelated changes here, please split

Yes, my bad… Already fixed.

@Nir-Az
Copy link
Collaborator

Nir-Az commented Dec 19, 2022

There are 2 unrelated changes here, please split

Until a code not passed all tests it was in the draft...

OK, You asked for a review :)

@Tamir91 Tamir91 force-pushed the bug/kw_division_by_zero_error_2 branch from 2454acd to f677d5c Compare December 19, 2022 15:28
The comment was updated according to a code.
@Nir-Az Nir-Az marked this pull request as ready for review December 21, 2022 08:31
Copy link
Collaborator

@Nir-Az Nir-Az left a comment

Choose a reason for hiding this comment

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

LGTM

@Nir-Az Nir-Az merged commit 6e5996e into IntelRealSense:development Dec 21, 2022
@Tamir91 Tamir91 deleted the bug/kw_division_by_zero_error_2 branch December 22, 2022 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants