clearitem: prevent NULL dereference - sacc - sacc(omys), simple console gopher client
 (HTM) git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) LICENSE
       ---
 (DIR) commit 74476b5fc0dff8d472e79c81c6a56ca1390fdf45
 (DIR) parent 45cf7e58579237078acd46c5e3139269e1105f66
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Thu, 13 Jul 2017 16:17:37 +0200
       
       clearitem: prevent NULL dereference
       
       Diffstat:
         M sacc.c                              |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/sacc.c b/sacc.c
       @@ -95,11 +95,14 @@ usage(void)
        static void
        clearitem(Item *item)
        {
       -        Dir *dir = item->dat;
       +        Dir *dir;
                Item **items;
                size_t i;
        
       -        if (dir) {
       +        if (!item)
       +                return;
       +
       +        if (dir = item->dat) {
                        items = dir->items;
                        for (i = 0; i < dir->nitems; ++i) {
                                clearitem(items[i]);