added a variable guard
diff --git a/tasks/download_files.yml b/tasks/download_files.yml
index c0defd3..199e096 100644
--- a/tasks/download_files.yml
+++ b/tasks/download_files.yml
@@ -9,4 +9,5 @@
     src: "{{ item.path }}"
     dest: "{{ download_folder }}"
   with_items: "{{ result.files }}"
+  when: result is defined and result.files is defined