Skip to content

Commit

Permalink
Prevent non-existing action removal
Browse files Browse the repository at this point in the history
  • Loading branch information
andfoy committed Aug 31, 2021
1 parent 295b720 commit cfb79c9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion spyder/api/widgets/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,15 @@ def add_action(self: T, action: Union[SpyderAction, T],
def remove_action(self, item_id: str):
if item_id in self._actions_map:
action = self._actions_map.pop(item_id)
self._actions.remove(action)
position = None

for i, (_, act) in enumerate(self._actions):
if act == action:
position = i
break

if position is not None:
self._actions.pop(position)

def get_title(self):
"""
Expand Down

0 comments on commit cfb79c9

Please sign in to comment.