oops, crash if searching for something smaller than * in the array

This commit is contained in:
Dana Jansens 2010-09-20 20:02:16 -04:00
parent d3660704f1
commit 7eeae03f06

View file

@ -40,8 +40,9 @@ G_BEGIN_DECLS
if ((val) == (ar)[out_BSEARCH]) { \ if ((val) == (ar)[out_BSEARCH]) { \
break; \ break; \
} \ } \
else if ((val) < (ar)[out_BSEARCH]) \ else if ((val) < (ar)[out_BSEARCH] && out_BSEARCH > 0) { \
r_BSEARCH = out_BSEARCH-1; /* search to the left side */ \ r_BSEARCH = out_BSEARCH-1; /* search to the left side */ \
} \
else \ else \
l_BSEARCH = out_BSEARCH+1; /* search to the left side */ \ l_BSEARCH = out_BSEARCH+1; /* search to the left side */ \
} \ } \