Add verification of number of items in the table to prevent editing an empty object with no index

This commit is contained in:
William Valentin
2025-07-15 14:36:17 -07:00
parent dcb6470797
commit 96fa2551f6

View File

@@ -123,6 +123,7 @@ class MedTrackerApp:
def on_double_click(self, event): def on_double_click(self, event):
"""Handle double-click event to edit an entry.""" """Handle double-click event to edit an entry."""
if len(self.tree.get_children()) > 0:
item_id = self.tree.selection()[0] item_id = self.tree.selection()[0]
item_values = self.tree.item(item_id, "values") item_values = self.tree.item(item_id, "values")
self.create_edit_window(item_id, item_values) self.create_edit_window(item_id, item_values)