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

Defects instantiation creates undefined/infinite bbox #179

Merged
merged 1 commit into from Apr 7, 2021

Conversation

czwa
Copy link
Contributor

@czwa czwa commented Apr 6, 2021

Do not normalize an empty Defects() object.

@@ -185,6 +185,10 @@ def _normalize(self):
if self._bulk_update:
return

# If we have no defects, there is nothing to normalize.
if len(self) <= 0:
Copy link
Member

Choose a reason for hiding this comment

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

can len return a negative number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

python is smarter than I thought, and even if you maliciously craft a class, you cannot return a negative length. Updated to "==".

Copy link
Contributor

@erykoff erykoff left a comment

Choose a reason for hiding this comment

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

Looks good!

@czwa czwa merged commit eadf320 into master Apr 7, 2021
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.

None yet

3 participants