Skip to content

Commit

Permalink
fix(/profile): Handle custom image remove error
Browse files Browse the repository at this point in the history
Fixes HOYO-BUDDY-8J
  • Loading branch information
seriaati committed Jun 20, 2024
1 parent 9d000cb commit 284ae6f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hoyo_buddy/ui/hoyo/profile/items/remove_img_btn.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import contextlib
from typing import TYPE_CHECKING

from discord import ButtonStyle
Expand Down Expand Up @@ -38,7 +39,10 @@ async def callback(self, i: Interaction) -> None:
# Remove the current image URL
current_image = self.view._card_settings.current_image
assert current_image is not None
self.view._card_settings.custom_images.remove(current_image)

with contextlib.suppress(ValueError):
# For whatever reason, the current image may not be in the custom images list
self.view._card_settings.custom_images.remove(current_image)

# Update the current image URL
self.view._card_settings.current_image = None
Expand Down

0 comments on commit 284ae6f

Please sign in to comment.