Skip to content

Division by zero might occur in viewer.cpp - #11233

Merged
Nir-Az merged 3 commits into
realsenseai:developmentfrom
Tamir91:bug/kw_division_by_zero_error_2
Dec 21, 2022
Merged

Division by zero might occur in viewer.cpp#11233
Nir-Az merged 3 commits into
realsenseai:developmentfrom
Tamir91:bug/kw_division_by_zero_error_2

Conversation

@Tamir91

@Tamir91 Tamir91 commented Dec 19, 2022

Copy link
Copy Markdown
Contributor

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

Nir-Az commented Dec 19, 2022

Copy link
Copy Markdown
Collaborator

Why draft?

@Nir-Az

Nir-Az commented Dec 19, 2022

Copy link
Copy Markdown
Collaborator

There are 2 unrelated changes here, please split

Comment thread common/viewer.cpp Outdated
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
Copy Markdown
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

Tamir91 commented Dec 19, 2022

Copy link
Copy Markdown
Contributor Author

There are 2 unrelated changes here, please split

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

@Tamir91

Tamir91 commented Dec 19, 2022

Copy link
Copy Markdown
Contributor Author

There are 2 unrelated changes here, please split

Yes, my bad… Already fixed.

@Nir-Az

Nir-Az commented Dec 19, 2022

Copy link
Copy Markdown
Collaborator

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

@Nir-Az Nir-Az left a comment

Copy link
Copy Markdown
Collaborator

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 realsenseai: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