Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix double item deletion crash #1955

Merged
merged 2 commits into from Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions pupil_src/shared_modules/gaze_producer/ui/calibration_menu.py
Expand Up @@ -169,6 +169,9 @@ def _on_click_duplicate_button(self):
super()._on_click_duplicate_button()

def _on_click_delete(self):
if self.current_item is None:
return

if not self._calibration_controller.is_from_same_recording(self.current_item):
logger.error("Cannot delete calibrations from other recordings!")
return
Expand Down
Expand Up @@ -96,6 +96,8 @@ def _on_click_duplicate_button(self):
self.render()

def _on_click_delete(self):
if self.current_item is None:
return
current_index = self.items.index(self.current_item)
self._storage.delete(self.current_item)
current_index = min(current_index, len(self.items) - 1)
Expand Down