FIX: Only delete theme folder if it has been created

approved
#1

FIX: Only delete theme folder if it has been created

If an exception is raised before the folder is created, then this ensure block is still run

diff --git a/lib/theme_store/git_importer.rb b/lib/theme_store/git_importer.rb
index f81e95e..6d8cee3 100644
--- a/lib/theme_store/git_importer.rb
+++ b/lib/theme_store/git_importer.rb
@@ -44,7 +44,7 @@ class ThemeStore::GitImporter
       return Discourse::Utils.execute_command("git", "diff", "--staged")
     end
   ensure
-    FileUtils.rm_rf local_temp_folder
+    FileUtils.rm_rf local_temp_folder if local_temp_folder
   end
 
   def commits_since(hash)

GitHub sha: 105359e5

2 Likes
Approved #2