-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Division by zero might occur in viewer.cpp #11233
Conversation
Why draft? |
There are 2 unrelated changes here, please split |
common/viewer.cpp
Outdated
@@ -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) |
There was a problem hiding this comment.
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()));
3214d44
to
2454acd
Compare
Until a code not passed all tests it was in the draft... |
Yes, my bad… Already fixed. |
OK, You asked for a review :) |
2454acd
to
f677d5c
Compare
The comment was updated according to a code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tracked on [LRS-570]
The division was surrounded by an "if" statement and "throw Exception" added.