1
0
Fork 0
mirror of synced 2024-06-26 10:11:19 +12:00

Fix wishlist, if empty

This commit is contained in:
Dummerle 2021-11-07 01:19:37 +01:00
parent f13412aba9
commit 8e94f1d6f5
No known key found for this signature in database
GPG key ID: AB68CC59CA39F2F1
2 changed files with 5 additions and 3 deletions

View file

@ -77,8 +77,7 @@ class ShopWidget(QScrollArea, Ui_ShopWidget):
item = self.discount_widget.layout().itemAt(i)
if item:
item.widget().deleteLater()
if wishlist[0] == "error":
if wishlist and wishlist[0] == "error":
self.discount_widget.layout().addWidget(QLabel(self.tr("Failed to get wishlist: ") + wishlist[1]))
btn = QPushButton(self.tr("Reload"))
self.discount_widget.layout().addWidget(btn)

View file

@ -364,7 +364,10 @@ class ImageLabel(QLabel):
self.show_image()
def image_ready(self, data):
self.setPixmap(QPixmap())
try:
self.setPixmap(QPixmap())
except Exception:
logger.warning("C++ object already removed, when image ready")
try:
image: Image.Image = Image.open(io.BytesIO(data))
except PIL.UnidentifiedImageError: