From 16fa26e1df63c9512f364aa7f92eeac6c292075a Mon Sep 17 00:00:00 2001 From: Dummerle <44114474+Dummerle@users.noreply.github.com> Date: Wed, 16 Mar 2022 17:46:57 +0100 Subject: [PATCH] Fix crash for Fortnite extension pack --- rare/components/tabs/games/__init__.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/rare/components/tabs/games/__init__.py b/rare/components/tabs/games/__init__.py index a169d741..34e7331a 100644 --- a/rare/components/tabs/games/__init__.py +++ b/rare/components/tabs/games/__init__.py @@ -194,6 +194,9 @@ class GamesTab(QStackedWidget, Ui_GamesTab): for game in self.no_assets: icon_widget, list_widget = self.add_installed_widget(game.app_name) + if not icon_widget or not list_widget: + logger.warning(f"Ignoring {game.app_name} in game list") + continue self.icon_view.layout().addWidget(icon_widget) self.list_view.layout().addWidget(list_widget) @@ -227,7 +230,7 @@ class GamesTab(QStackedWidget, Ui_GamesTab): list_widget = InstalledListWidget(app_name, pixmap, self.game_utils) except Exception as e: logger.error(f"{app_name} is broken. Don't add it to game list: {e}") - return + return None, None self.widgets[app_name] = (icon_widget, list_widget) @@ -253,7 +256,7 @@ class GamesTab(QStackedWidget, Ui_GamesTab): list_widget = ListWidgetUninstalled(self.core, game, pixmap) except Exception as e: logger.error(f"{game.app_name} is broken. Don't add it to game list: {e}") - return + return None, None icon_widget.show_uninstalled_info.connect(self.show_uninstalled_info) list_widget.show_uninstalled_info.connect(self.show_uninstalled_info) @@ -361,7 +364,10 @@ class GamesTab(QStackedWidget, Ui_GamesTab): self.widgets.pop(app_name) game = self.core.get_game(app_name, False) - self.add_uninstalled_widget(game) + try: + self.add_uninstalled_widget(game) + except Exception: + pass update_list = True # do not update, if only update finished @@ -406,7 +412,10 @@ class GamesTab(QStackedWidget, Ui_GamesTab): self.widgets.pop(name) game = self.core.get_game(name, False) - self.add_uninstalled_widget(game) + try: + self.add_uninstalled_widget(game) + except Exception: + pass for igame in sorted( self.core.get_installed_list(), key=lambda x: x.title @@ -471,6 +480,9 @@ class GamesTab(QStackedWidget, Ui_GamesTab): logger.warning("Found installed game, without widget. Generating widget... ") try: i_widget, l_widget = self.add_uninstalled_widget(game) + if not i_widget or not l_widget: + logger.warning(f"Ignoring {game.app_name}") + continue icon_layout.addWidget(i_widget) list_layout.addWidget(l_widget) except Exception as e: