summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdiskfs/name-cache.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libdiskfs/name-cache.c b/libdiskfs/name-cache.c
index 60f6c3fb..e4a7de91 100644
--- a/libdiskfs/name-cache.c
+++ b/libdiskfs/name-cache.c
@@ -86,7 +86,8 @@ diskfs_enter_cache (struct node *dir, struct node *np, char *name)
/* Add the new entry at the front */
lc->next = lookup_cache_head;
lc->prev = 0;
- lc->next->prev = lc;
+ if (lc->next)
+ lc->next->prev = lc;
lookup_cache_head = lc;
if (!lc->next)
lookup_cache_tail = lc;