X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fopenbox;a=blobdiff_plain;f=obt%2Fbsearch.h;fp=obt%2Fbsearch.h;h=9613c51b36dda4f86cddabfc19bec7a4033cc9a6;hp=65e426806f898fff58222d8cea30e9364cb0079e;hb=7eeae03f0668cbdfe461d126e076dd97a98b6b05;hpb=d3660704f1195fb724f5c0c027bdd084824c511f diff --git a/obt/bsearch.h b/obt/bsearch.h index 65e42680..9613c51b 100644 --- a/obt/bsearch.h +++ b/obt/bsearch.h @@ -40,8 +40,9 @@ G_BEGIN_DECLS if ((val) == (ar)[out_BSEARCH]) { \ 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 */ \ + } \ else \ l_BSEARCH = out_BSEARCH+1; /* search to the left side */ \ } \