From b38dd088f58020a2b9808f167be99d1846a0e74f Mon Sep 17 00:00:00 2001 From: Bram Wasti Date: Tue, 6 Jan 2015 22:07:06 -0500 Subject: [PATCH] check if file exists and default to character representation if it doesn't --- bar.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bar.c b/bar.c index 61f2baa..987548e 100644 --- a/bar.c +++ b/bar.c @@ -281,6 +281,11 @@ bool get_image_file(char *str, char *optend, char **end) img_file = p; *end = trail + 1; + /* Check if the image exists. */ + if (access(img_file, F_OK) == -1) { + return false; + } + return true; }