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

Checks if batch_scanned_event is initialized before calling .set() #7

Merged
merged 1 commit into from
Oct 14, 2021

Conversation

pheaney-sra
Copy link
Contributor

Encountered an issue where batch_scanned_event would be initialized as None and remain in this state when blocking=True on line 174. batch_scanned_event is only initialized on line 191 if blocking is False. Because the object was set to None, an AttributeError is raised.

...
CornerShot got exception - 'NoneType' object has no attribute 'set'
CornerShot unexpected exception!
Traceback (most recent call last):
  File "/home/ph/.local/lib/python3.8/site-packages/cornershot/__main__.py", line 113, in <module>
    cs.open_fire()
  File "/home/ph/.local/lib/python3.8/site-packages/cornershot/cornershot.py", line 186, in open_fire
    self._shots_manager()
  File "/home/ph/.local/lib/python3.8/site-packages/cornershot/cornershot.py", line 165, in _shots_manager
    self.batch_scanned_event.set()
AttributeError: 'NoneType' object has no attribute 'set'
...

Added checks on two lines that reference batch_scanned_event to ensure the variable is initialized before using the .set() method. Tested Cornershot with this change and the exception is no longer raised.

Please feel free to reach out if you have any questions; happy to discuss.

Copy link
Member

@sagiesec sagiesec left a comment

Choose a reason for hiding this comment

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

Good catch, thanks

@sagiesec sagiesec merged commit edfe95c into zeronetworks:master Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants