commit ba17729f6568efab7cacfc292670169437cbbda8
parent becb7139e103a5ec8c18568a6cdbe756cb081ffd
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 11 Jun 2017 16:06:52 +0200
tolerate empty transaction list when returning history
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
@@ -521,7 +521,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
else
pos = h->transactions_tail;
}
- else
+ else if (NULL != h->transactions_head)
{
for (pos = h->transactions_head;
NULL != pos;
@@ -539,6 +539,11 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
if (count < 0)
pos = pos->prev;
}
+ else
+ {
+ /* list is empty */
+ pos = NULL;
+ }
history = json_array ();
while ( (NULL != pos) &&
(0 != count) )