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-Tag: release-3.5.0~56 X-Git-Url: http://git.openbox.org/?p=dana%2Fopenbox.git;a=commitdiff_plain;h=7eeae03f0668cbdfe461d126e076dd97a98b6b05 oops, crash if searching for something smaller than * in the array --- diff --git a/obt/bsearch.h b/obt/bsearch.h index 65e4268..9613c51 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 */ \ } \