Skip to content

Commit

Permalink
Fixing Sentry #OPENSHOT-4D: Couldn't apply 'update' to update listene…
Browse files Browse the repository at this point in the history
…r: <windows.models.properties_model.PropertiesModel object at 0x000002407f9bf4c0>. list index out of range. This was mostly caused by "load" UpdateActions, which have an empty list as a key.
  • Loading branch information
jonoomph committed Jul 9, 2024
1 parent 10a24e5 commit fddbdd0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/windows/models/properties_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class PropertiesModel(updates.UpdateInterface):
def changed(self, action):

# Handle change
if action.key and action.key[0] in ["clips", "effects"] and action.type in ["update", "insert"]:
if len(action.key) >= 1 and action.key[0] in ["clips", "effects"] and action.type in ["update", "insert"]:
log.debug(action.values)
# Update the model data
self.update_model(get_app().window.txtPropertyFilter.text())
Expand Down
2 changes: 1 addition & 1 deletion src/windows/video_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class VideoWidget(QWidget, updates.UpdateInterface):
# This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface)
def changed(self, action):
# Handle change
if (action.key and action.key[0] in [
if (len(action.key) >= 1 and action.key[0] in [
"display_ratio", "pixel_ratio"
] or action.type in ["load"]):
# Update display ratio (if found)
Expand Down
2 changes: 1 addition & 1 deletion src/windows/views/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def changed(self, action):
return

# Bail out if change unrelated to webview
if action.key and action.key[0] not in ["clips", "effects", "duration", "layers", "markers"]:
if len(action.key) >= 1 and action.key[0] not in ["clips", "effects", "duration", "layers", "markers"]:
log.debug(f"Skipping unneeded webview update for '{action.key[0]}'")
return

Expand Down
4 changes: 4 additions & 0 deletions src/windows/views/timeline_backend/qwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def get_html(self):

# This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface)
def changed(self, action):
# Ignore changes that don't affect this
if action and len(action.key) >= 1 and action.key[0].lower() in ["files", "history", "profile"]:
return

# Clear previous rects
self.clip_rects.clear()
self.clip_rects_selected.clear()
Expand Down
4 changes: 4 additions & 0 deletions src/windows/views/zoom_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class ZoomSlider(QWidget, updates.UpdateInterface):

# This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface)
def changed(self, action):
# Ignore changes that don't affect this
if action and len(action.key) >= 1 and action.key[0].lower() in ["files", "history", "profile"]:
return

# Clear previous rects
self.clip_rects.clear()
self.clip_rects_selected.clear()
Expand Down

0 comments on commit fddbdd0

Please sign in to comment.