tFix handling of empty (failed) dir items - sacc - sacc (saccomys): simple gopher client.
Log
Files
Refs
LICENSE
---
commit 4dff6dde00bd2e8062f678d6ca2207d00119474f
parent f4d2323a6ee66f698e6f1b0611bd3beb04761330
Author: Quentin Rameau 
Date:   Thu,  6 Jul 2017 13:36:08 +0200

Fix handling of empty (failed) dir items

Diffstat:
  sacc.c                              |       7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/sacc.c b/sacc.c
t@@ -232,8 +232,10 @@ molddiritem(char *raw)
                 }
         }
 
-        if (!items)
+        if (!items) {
+                free(dir);
                 return NULL;
+        }
 
         dir->items = items;
         dir->nitems = nitems;
t@@ -383,7 +385,8 @@ delve(Item *hole)
                         displaytextitem(hole);
                         break;
                 case '1':
-                        entry = hole;
+                        if (hole->dir)
+                                entry = hole;
                         break;
                 case 0:
                         fprintf(stderr, "Couldn't get %s:%s/%c%s\n", hole->host,