From 29fc286ba3fc3ea820ee03ee716db4e5e4aa135c Mon Sep 17 00:00:00 2001 From: Jinhao Date: Thu, 31 Aug 2017 04:36:09 +0800 Subject: [PATCH] fix bug that throws exception in listbox::column_at(#248) --- source/gui/widgets/listbox.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index a6161056..c49841c5 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -433,8 +433,16 @@ namespace nana { check_range(pos, cont_.size()); + //The order of cont_'s elements is the display order. if (!disp_order) - pos = this->cast(pos, false); + { + /// It always match the item with pos, otherwise a bug occurs. + for (auto & m : cont_) + { + if (m.index == pos) + return m; + } + } return cont_[pos]; }