From 057c295af61780d7ecafe379aa08fd3412414319 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 2 Feb 2020 23:57:18 +0100 Subject: [PATCH] Fix uncaught exception --- src/flistview.cpp | 11 ++++++++++- test/foptiattr-test.cpp | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/flistview.cpp b/src/flistview.cpp index 1987bfdf..9bb21669 100644 --- a/src/flistview.cpp +++ b/src/flistview.cpp @@ -1839,7 +1839,16 @@ inline FString FListView::getCheckBox (const FListViewItem* item) checkbox.setString("[ ] "); if ( item->isChecked() ) - checkbox[1] = fc::Times; // Times × + { + try + { + checkbox[1] = fc::Times; // Times × + } + catch (const std::out_of_range&) + { + return checkbox; + } + } } return checkbox; diff --git a/test/foptiattr-test.cpp b/test/foptiattr-test.cpp index a04e9901..b1cda4a2 100644 --- a/test/foptiattr-test.cpp +++ b/test/foptiattr-test.cpp @@ -281,6 +281,9 @@ void FOptiAttrTest::sgrOptimizerTest() std::strcpy(buffer, CSI "m" CSI "38;2;0;139;139m" CSI "48;2;240;255;240m"); sgr_optimizer.optimize(); CPPUNIT_ASSERT_CSTRING ( buffer, C_STR(CSI "0;38;2;0;139;139;48;2;240;255;240m") ); + + delete to; + delete from; } //----------------------------------------------------------------------