# HG changeset patch # User Matti Hamalainen # Date 1456383271 -7200 # Node ID 5c5b3919263deac5c0449065f28c71bf0e37f1ed # Parent a001708551d0baa162f76dbcf81b07becc8dd4ed th_llist_get_nth() returned last value of list if N > number of elements. Now it returns NULL N != nElems. diff -r a001708551d0 -r 5c5b3919263d th_datastruct.c --- 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; }