09-02-2014 02:52 AM
I found even if not create the list, the function ListNumItems() can still return back a zero. This will make a confusing because the return value cannot instruct an error of that the list has not been created.
David
09-02-2014 06:51 AM - edited 09-02-2014 06:52 AM
You can use the toolbox macro VALIDATE_LIST (list) before trying to access the list. The macro is defined in toolbox.h and returns 0 if the list passed is not a valid one. See the code for ListNumItems in toolbox.c file.
Having said this, that function could be modified so that it returns -1 in case the list is not valid instead of 0, which is a valid return value for the function. You can modify it on your own and recompile the toolbox library.