Skip to content

Commit 8ff253e

Browse files
committed
Protecting property widget exception when a label returns an invalid data tuple for the current selected property label: Setnry reported this error: OPENSHOT-43.
1 parent 1e07ee3 commit 8ff253e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/windows/views/properties_tableview.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,16 @@ def mouseMoveEvent(self, event):
205205
cursor_value = event.x() - value_column_x
206206
cursor_value_percent = cursor_value / self.columnWidth(1)
207207

208+
# Get data from selected item
208209
try:
209210
cur_property = self.selected_label.data()
210211
except Exception:
211-
# If item is deleted during this drag... an exception can occur
212-
# Just ignore, since this is harmless
213212
log.debug('Failed to access data on selected label widget')
213+
return
214+
215+
if type(cur_property) != tuple:
216+
log.debug('Failed to access valid data on current selected label widget')
217+
return
214218

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

441445
# Get data from selected item
442-
cur_property = selected_label.data()
446+
try:
447+
cur_property = self.selected_label.data()
448+
except Exception:
449+
log.debug('Failed to access data on selected label widget')
450+
return
451+
452+
if type(cur_property) != tuple:
453+
log.debug('Failed to access valid data on current selected label widget')
454+
return
455+
443456
property_name = cur_property[1]["name"]
444457
self.property_type = cur_property[1]["type"]
445458
points = cur_property[1]["points"]

0 commit comments

Comments
 (0)