From d848220d1b93a7884d51b6bad8bd953296b93894 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Fri, 20 Sep 2024 07:28:23 +0100 Subject: [PATCH] pupgui2: Don't attempt to map `install_directory` if `combo_install_location_index_map` is empty (#458) --- pupgui2/pupgui2.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pupgui2/pupgui2.py b/pupgui2/pupgui2.py index c46ed78e..fd9dedc4 100644 --- a/pupgui2/pupgui2.py +++ b/pupgui2/pupgui2.py @@ -398,11 +398,17 @@ def btn_close_clicked(self): self.cancel_download(cancel_all=True) self.ui.close() - def combo_install_location_current_index_changed(self): + def combo_install_location_current_index_changed(self) -> None: + if len(self.combo_install_location_index_map) <= 0: + self.update_ui() + + return + if not self.updating_combo_install_location: install_dir = install_directory(self.combo_install_location_index_map[self.ui.comboInstallLocation.currentIndex()]) self.ui.statusBar().showMessage(self.tr('Changed install directory to {install_dir}.').format(install_dir=install_dir), timeout=3000) - self.update_ui() + + self.update_ui() def btn_manage_install_locations_clicked(self): customid_dialog = PupguiCustomInstallDirectoryDialog(install_directory(), parent=self.ui)