From cc2d161a6ef0700f6d08fd5c63314834a7264c28 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 2 Jan 2017 11:38:20 +0100
Subject: [PATCH] To feed generator, add handler for case of empty blog.

---
 processor/feed.xml.do | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/processor/feed.xml.do b/processor/feed.xml.do
index 717fa89..0bc7318 100644
--- a/processor/feed.xml.do
+++ b/processor/feed.xml.do
@@ -47,7 +47,11 @@ for file in ./*.rst ./*.md; do
 done
 
 # Derive feed modification date from snippets.
-mod_dates=$(grep -hE "^<updated>" ./${metadata_dir}/*.feed_snippet | sed -E 's/<.?updated>//g')
+n_snippet_files=`ls -1 ./${metadata_dir}/*.feed_snippet 2>/dev/null | wc -l`
+if [ $n_snippet_files != 0 ]
+then
+  mod_dates=$(grep -hE "^<updated>" ./${metadata_dir}/*.feed_snippet | sed -E 's/<.?updated>//g')
+fi
 last_mod_unix=0
 for date in $mod_dates; do
   date_unix=$(date -u "+%s" -d "${date}")
-- 
2.30.2