Avoid undefined results when the parameter is out of range.
This commit is contained in:
parent
f36f469430
commit
7ef7a1b3de
1 changed files with 1 additions and 1 deletions
|
@ -306,7 +306,7 @@ int sk_num(const STACK *st)
|
||||||
|
|
||||||
char *sk_value(const STACK *st, int i)
|
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];
|
return st->data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue