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

Protect filter() against damaged projects #3181

Merged
merged 1 commit into from
Feb 28, 2020
Merged

Conversation

ferdnyc
Copy link
Contributor

@ferdnyc ferdnyc commented Jan 17, 2020

In #3171 a user uploaded logs that contained a bunch of these errors:

 main_window:INFO main::addSelection: item_id: , item_type: effect, clear_existing: True
  exceptions:ERROR Unhandled Exception
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/openshot_qt/windows/views/properties_tableview.py", line 699, in select_item
    clip = Clip.get(id=self.item_id)
  File "/usr/lib/python3.6/site-packages/openshot_qt/classes/query.py", line 162, in get
    return QueryObject.get(Clip, **kwargs)
  File "/usr/lib/python3.6/site-packages/openshot_qt/classes/query.py", line 135, in get
    matching_objects = QueryObject.filter(OBJECT_TYPE, **kwargs)
  File "/usr/lib/python3.6/site-packages/openshot_qt/classes/query.py", line 110, in filter
    if key in child and not child[key] == value:
TypeError: argument of type 'NoneType' is not iterable

It doesn't appear they're fatal, though they may have led to the subsequent project-loading issues experienced. Regardless, it's a good idea to protect against them. This should.

The unit tests still pass, so that should hopefully be a good sign that it at least doesn't make things worse.

@SuslikV
Copy link
Contributor

SuslikV commented Jan 17, 2020

The log import part

from classes.logger import log

not required, I think.

@ferdnyc
Copy link
Contributor Author

ferdnyc commented Jan 18, 2020

Whoops, did I leave that in? Quite right, thanks. Fixed.

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.

3 participants