From 0b49021a6c676975d93c83e1e4228f96136c334c Mon Sep 17 00:00:00 2001
From: "Chris West (Faux)" <git@goeswhere.com>
Date: Tue, 21 Aug 2012 17:16:28 +0100
Subject: [PATCH] 399ccdeb caused a crash on non-existent directories on the
 command line

---
 src/calc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/calc.c b/src/calc.c
index bef226e..01b6971 100644
--- a/src/calc.c
+++ b/src/calc.c
@@ -367,7 +367,7 @@ int calc_key(int ch) {
 
 
 int calc_process() {
-  char *path, *name;
+  char *path = NULL, *name = NULL;
   struct stat fs;
   struct dir *t;
   int n;
@@ -494,7 +494,7 @@ int calc_process() {
   /* something went wrong... */
   freedir(root);
 calc_fail:
-  if(!path[1] && strcmp(name, "."))
+  if(name && path && !path[1] && strcmp(name, "."))
     free(name);
   free(path);
 
-- 
GitLab