From a1eaed02a2a373d149239952dc515b759044d5c1 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 2 Jan 2017 04:02:47 +0100
Subject: [PATCH] Harden against lack of blog entries.

---
 processor/feed.xml.do   | 6 ++++--
 processor/index.html.do | 8 +++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/processor/feed.xml.do b/processor/feed.xml.do
index 19ba026..717fa89 100644
--- a/processor/feed.xml.do
+++ b/processor/feed.xml.do
@@ -60,8 +60,10 @@ printf "<updated>%s</updated>\n\n" "$lastmod_rfc3339"
 
 # Write feed entries.
 for file in ./${tmp_snippets_dir}/*; do
-  cat "${file}"
-  printf "\n"
+  if [ -e "$file" ]; then
+    cat "${file}"
+    printf "\n"
+  fi
 done
 rm -rf "$tmp_snippets_dir"
 
diff --git a/processor/index.html.do b/processor/index.html.do
index 105bc74..5149cac 100644
--- a/processor/index.html.do
+++ b/processor/index.html.do
@@ -29,9 +29,11 @@ done
 
 # Write link list.
 for file in ./${tmp_snippets_dir}/*; do
-  touch ./${tmp_snippets_dir}/list
-  cat "$file" ./${tmp_snippets_dir}/list > ./${tmp_snippets_dir}/tmp
-  mv ./${tmp_snippets_dir}/tmp ./${tmp_snippets_dir}/list
+  if [ -e "$file" ]; then
+    touch ./${tmp_snippets_dir}/list
+    cat "$file" ./${tmp_snippets_dir}/list > ./${tmp_snippets_dir}/tmp
+    mv ./${tmp_snippets_dir}/tmp ./${tmp_snippets_dir}/list
+  fi
 done
 if [ -e "./${tmp_snippets_dir}/list" ]; then
   list=$(cat ./${tmp_snippets_dir}/list | prep_sed)
-- 
2.30.2