From: Dana Jansens Date: Tue, 21 Sep 2010 00:02:16 +0000 (-0400) Subject: oops, crash if searching for something smaller than * in the array X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=7eeae03f0668cbdfe461d126e076dd97a98b6b05;p=chaz%2Fopenbox oops, crash if searching for something smaller than * in the array --- 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 */ \ } \