changeset 349:5c5b3919263d

th_llist_get_nth() returned last value of list if N > number of elements. Now it returns NULL N != nElems.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 25 Feb 2016 08:54:31 +0200
parents a001708551d0
children 19d4b3a1a37c
files th_datastruct.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/th_datastruct.c	Thu Feb 25 08:53:41 2016 +0200
+++ b/th_datastruct.c	Thu Feb 25 08:54:31 2016 +0200
@@ -229,7 +229,7 @@
 
     for (i = 0; curr != NULL && i < n; curr = curr->next, i++);
 
-    return curr;
+    return (i == n) ? curr : NULL;
 }