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

Fix TypeError when calling `destroy()` on an image #346

Closed
wants to merge 1 commit into
base: master
from

Conversation

2 participants
@pR0Ps

pR0Ps commented Sep 6, 2017

Image objects with a sequence attribute of None would raise an error when destroy() was called on them.

This commit fixes the issue by only attempting to pop items from the sequence if the sequence is truthy.

Error for reference:

Exception ignored in: <bound method Resource.__del__ of <wand.image.Image: ddfad51 'CR2' (5202x3465)>>
Traceback (most recent call last):
  File "[redacted]/.venv/lib/python3.6/site-packages/wand/resource.py", line 232, in __del__
    self.destroy()
  File "[redacted]/.venv/lib/python3.6/site-packages/wand/image.py", line 2767, in destroy
    for i in range(0, len(self.sequence)):
TypeError: object of type 'NoneType' has no len()
Fix TypeError when calling `destroy()` on an image
`Image` objects with a `sequence` attribute of `None` would raise an error when `destroy()` was called on them.

This commit fixes the issue by only attempting to pop items from the sequence if the sequence is truthy.

NotSoSuper added a commit to NotSoSuper/wand that referenced this pull request Apr 13, 2018

@emcconville emcconville added this to the 0.4.5 milestone Nov 2, 2018

@emcconville

This comment has been minimized.

Owner

emcconville commented Nov 2, 2018

Implemented this change set on master branch. Looks like the original source repo was removed, so I couldn't merge directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment