tolerate empty transaction list when returning history

This commit is contained in:
Christian Grothoff 2017-06-11 16:06:52 +02:00
parent becb7139e1
commit ba17729f65
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -521,7 +521,7 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
else else
pos = h->transactions_tail; pos = h->transactions_tail;
} }
else else if (NULL != h->transactions_head)
{ {
for (pos = h->transactions_head; for (pos = h->transactions_head;
NULL != pos; NULL != pos;
@ -539,6 +539,11 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
if (count < 0) if (count < 0)
pos = pos->prev; pos = pos->prev;
} }
else
{
/* list is empty */
pos = NULL;
}
history = json_array (); history = json_array ();
while ( (NULL != pos) && while ( (NULL != pos) &&
(0 != count) ) (0 != count) )