From 8db5795f3cf446bda85822b4bc2ea527dc1db4b9 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Fri, 27 Aug 2021 02:21:55 +0000
Subject: [PATCH] Check for no time, meaning cant fetch json
---
reddit-wallpaper-fetcher | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/reddit-wallpaper-fetcher b/reddit-wallpaper-fetcher
index ee62a28..5690ff5 100755
--- a/reddit-wallpaper-fetcher
+++ b/reddit-wallpaper-fetcher
@@ -41,6 +41,9 @@
for i in "${SUBREDDITS[@]}"; do
temp=$(curl "$LOUD" --user-agent "$USER" "https://www.reddit.com/r/$i.json?sort=$SORT&limit=1")
time=$(echo "$temp" | jq -r ".data.children[-1].data.created_utc")
+ if [ "$time" == "null" ]; then
+ continue
+ fi
if [ $(awk -v n1="$time" -v n2="$LATEST_TIME" 'BEGIN {printf (n1>n2?"1":"")}') ]; then
LATEST="$temp"
LATEST_TIME="$time"
--
Gitblit v1.10.0