From c4b0ee0ea7b5eabcfcebd721410931afc6de38b6 Mon Sep 17 00:00:00 2001 From: joncruz Date: Sat, 1 Mar 2008 09:03:29 +0000 Subject: [PATCH] Fix to check for out of bounds index *before* using the array index --- src/display/nr-filter-slot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp index 76beb12f5..1501afcbe 100644 --- a/src/display/nr-filter-slot.cpp +++ b/src/display/nr-filter-slot.cpp @@ -308,7 +308,7 @@ int FilterSlot::_get_index(int slot_nr) int seek = _slot_count; do { seek--; - } while (_slot_number[seek] == NR_FILTER_SLOT_NOT_SET && seek >= 0); + } while ((seek >= 0) && (_slot_number[seek] == NR_FILTER_SLOT_NOT_SET)); /* If there is no space for more slots, create more space */ if (seek == _slot_count - 1) { NRPixBlock **new_slot = new NRPixBlock*[_slot_count * 2]; -- 2.30.2