From d7daeec6899ddaf5fd1497d337211405a740c730 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 2 Jul 2007 20:55:50 +0000 Subject: [PATCH] reclist_rewind and reclist_read_record handles non-existing reclist --- src/reclists.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/reclists.c b/src/reclists.c index 0587153..3d4c7fc 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -1,4 +1,4 @@ -/* $Id: reclists.c,v 1.17 2007-05-11 06:48:32 adam Exp $ +/* $Id: reclists.c,v 1.18 2007-07-02 20:55:50 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -212,7 +212,7 @@ void reclist_sort(struct reclist *l, struct reclist_sortparms *parms) struct record_cluster *reclist_read_record(struct reclist *l) { - if (l->pointer < l->num_records) + if (l && l->pointer < l->num_records) return l->flatlist[l->pointer++]; else return 0; @@ -220,7 +220,8 @@ struct record_cluster *reclist_read_record(struct reclist *l) void reclist_rewind(struct reclist *l) { - l->pointer = 0; + if (l) + l->pointer = 0; } // Jenkins one-at-a-time hash (from wikipedia) -- 1.7.10.4