From 7eeae03f0668cbdfe461d126e076dd97a98b6b05 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 20 Sep 2010 20:02:16 -0400 Subject: [PATCH] oops, crash if searching for something smaller than * in the array --- obt/bsearch.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 */ \ } \ -- 2.44.0