Skip to content

Commit

Permalink
Protecting property widget exception when a label returns an invalid …
Browse files Browse the repository at this point in the history
…data tuple for the current selected property label: Setnry reported this error: OPENSHOT-43.
  • Loading branch information
jonoomph committed Apr 13, 2023
1 parent 1e07ee3 commit 8ff253e
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/windows/views/properties_tableview.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,16 @@ def mouseMoveEvent(self, event):
cursor_value = event.x() - value_column_x
cursor_value_percent = cursor_value / self.columnWidth(1)

# Get data from selected item
try:
cur_property = self.selected_label.data()
except Exception:
# If item is deleted during this drag... an exception can occur
# Just ignore, since this is harmless
log.debug('Failed to access data on selected label widget')
return

if type(cur_property) != tuple:
log.debug('Failed to access valid data on current selected label widget')
return

property_key = cur_property[0]
property_name = cur_property[1]["name"]
Expand Down Expand Up @@ -439,7 +443,16 @@ def contextMenuEvent(self, event):
self.menu_reset = False

# Get data from selected item
cur_property = selected_label.data()
try:
cur_property = self.selected_label.data()
except Exception:
log.debug('Failed to access data on selected label widget')
return

if type(cur_property) != tuple:
log.debug('Failed to access valid data on current selected label widget')
return

property_name = cur_property[1]["name"]
self.property_type = cur_property[1]["type"]
points = cur_property[1]["points"]
Expand Down

0 comments on commit 8ff253e

Please sign in to comment.