From f035196886f3617725ed45f0dba37789eaf8826a Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 30 Jan 2016 17:55:31 +1100 Subject: [PATCH] Properly fallback to ascii mode if isn't a file --- fetch | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fetch b/fetch index ad1f085f..40a7b500 100755 --- a/fetch +++ b/fetch @@ -1519,11 +1519,17 @@ getimage () { esac # If $img is empty, reset padding to 0 and exit the function - if [ -z "$img" ]; then - padding="\033[0C" + if [ ! -f "$img" ]; then + # Fallback to ascii mode + image="ascii" + getascii + return fi + # Lines equals terminal height + lines=$(tput lines) + # Check to see if the image has a file extension case "${img##*/}" in *"."*) @@ -1590,9 +1596,6 @@ getimage () { esac fi - # Lines equals terminal height - lines=$(tput lines) - # The final image img="$imgtempdir/$imgname" }