Avoid undefined results when the parameter is out of range.

This commit is contained in:
Geoff Thorpe 2004-04-02 06:25:11 +00:00
parent b6a5fdb8a7
commit 2749276b95

View File

@ -307,7 +307,7 @@ int sk_num(const STACK *st)
char *sk_value(const STACK *st, int i)
{
if(st == NULL) return NULL;
if(!st || (i < 0) || (i >= st->num)) return NULL;
return st->data[i];
}