diff --git a/src/common/dynarray.cpp b/src/common/dynarray.cpp index 676bd6ba25..f55c594a3b 100644 --- a/src/common/dynarray.cpp +++ b/src/common/dynarray.cpp @@ -493,8 +493,20 @@ int wxSortedArrayString::Index(const wxChar* sz, bool bCase, bool WXUNUSED(bFrom it = std::lower_bound(begin(), end(), sz, wxStringCompareLess(wxStricmpCppWrapper)); - if (it == end() || (bCase ? wxStrcmp : wxStricmp)(it->c_str(), sz) != 0) + if (it == end()) return wxNOT_FOUND; + + if (bCase) + { + if (wxStrcmp(it->c_str(), sz) != 0) + return wxNOT_FOUND; + } + else + { + if (wxStricmp(it->c_str(), sz) != 0) + return wxNOT_FOUND; + } + return it - begin(); }