From 30c798b70a96636f865b38d896787342150cec3b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 30 Jun 2018 23:17:37 +0200 Subject: [PATCH] Fix row validity check in MacHandleSelectionChange() Valid indices must be in [0, count[ half-open interval. --- src/osx/listbox_osx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index 01b6ef7f0d..b00514c94f 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -439,7 +439,7 @@ void wxListBox::MacHandleSelectionChange(int row) // Otherwise call DoChangeSingleSelection so GetOldSelection() will return // the correct value if row < 0 later. const int count = static_cast(GetCount()); - if ( row < 0 || row > count ) + if ( row < 0 || row >= count ) { if ( !m_oldSelections.empty() ) {