Division by zero might occur in viewer.cpp - #11233
Merged
Nir-Az merged 3 commits intoDec 21, 2022
Merged
Conversation
Tamir91
marked this pull request as draft
December 19, 2022 12:57
Collaborator
|
Why draft? |
Collaborator
|
There are 2 unrelated changes here, please split |
Nir-Az
reviewed
Dec 19, 2022
| 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) |
Collaborator
There was a problem hiding this comment.
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
force-pushed
the
bug/kw_division_by_zero_error_2
branch
from
December 19, 2022 15:13
3214d44 to
2454acd
Compare
Contributor
Author
Until a code not passed all tests it was in the draft... |
Contributor
Author
Yes, my bad… Already fixed. |
Collaborator
OK, You asked for a review :) |
Tamir91
force-pushed
the
bug/kw_division_by_zero_error_2
branch
from
December 19, 2022 15:28
2454acd to
f677d5c
Compare
The comment was updated according to a code.
Nir-Az
marked this pull request as ready for review
December 21, 2022 08:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracked on [LRS-570]
The division was surrounded by an "if" statement and "throw Exception" added.