Add verification of number of items in the table to prevent editing an empty object with no index
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user