From 091f876f017dee24aaa2b8e92463536f43aff054 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 4 Nov 2011 13:38:39 +0000 Subject: [PATCH] handle NULL --- src/fs/gnunet-service-fs_indexing.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/fs/gnunet-service-fs_indexing.c b/src/fs/gnunet-service-fs_indexing.c index ce3f21cd6..5978e4d66 100644 --- a/src/fs/gnunet-service-fs_indexing.c +++ b/src/fs/gnunet-service-fs_indexing.c @@ -538,7 +538,8 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key, uint32_t size, odb = (const struct OnDemandBlock *) data; off = GNUNET_ntohll (odb->offset); fn = (const char *) GNUNET_CONTAINER_multihashmap_get (ifm, &odb->file_id); - if (0 != ACCESS (fn, R_OK)) + if ( (NULL == fn) || + (0 != ACCESS (fn, R_OK)) ) { GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# index blocks removed: original file inaccessible"), @@ -548,9 +549,7 @@ GNUNET_FS_handle_on_demand_block (const GNUNET_HashCode * key, uint32_t size, GNUNET_TIME_UNIT_FOREVER_REL, &remove_cont, NULL); return GNUNET_SYSERR; } - fh = NULL; - if ((NULL == fn) || - (NULL == + if ((NULL == (fh = GNUNET_DISK_file_open (fn, GNUNET_DISK_OPEN_READ, GNUNET_DISK_PERM_NONE))) || -- 2.25.1