From 6d332f613e3f254773b7318119f52950b461c603 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:13:29 +0900 Subject: [PATCH] chore: guard clause --- helpers/ui.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/helpers/ui.py b/helpers/ui.py index cd61034..7d1f81e 100644 --- a/helpers/ui.py +++ b/helpers/ui.py @@ -1132,15 +1132,16 @@ class TreeView(Gtk.TreeView): success_msg = "Successfully deleted the mod '%s'." %(value) fail_msg = "An error occurred during deletion. Aborting." res = spawn_dialog(parent, conf_msg, Popup.CONFIRM) - if res == 0: - mods = [] - symlink = self.get_column_at_index(1) - dir = self.get_column_at_index(2) - concat = symlink + " " + dir + "\n" - mods.append(concat) - with open(mods_temp_file, "w") as outfile: - outfile.writelines(mods) - process_tree_option([self.view, RowType.DELETE_SELECTED], self) + if res != 0: + return + mods = [] + symlink = self.get_column_at_index(1) + dir = self.get_column_at_index(2) + concat = symlink + " " + dir + "\n" + mods.append(concat) + with open(mods_temp_file, "w") as outfile: + outfile.writelines(mods) + process_tree_option([self.view, RowType.DELETE_SELECTED], self) case "Open in Steam Workshop": record = self.get_column_at_index(2) base_cmd = "open_workshop_page"