From: Uwe Hermann Date: Thu, 14 Mar 2019 20:22:47 +0000 (+0100) Subject: DecoderSelector: Fix catching polymorphic types by value. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3d3eca621487bd58cfcf72cc6ed4f2b1274af735;p=pulseview.git DecoderSelector: Fix catching polymorphic types by value. [...]/pv/subwindows/decoder_selector/item.cpp: In member function ‘std::shared_ptr pv::subwindows::decoder_selector::DecoderCollectionItem::subItem(int) const’: [...]/pv/subwindows/decoder_selector/item.cpp:44:11: warning: catching polymorphic type ‘class std::out_of_range’ by value [-Wcatch-value=] } catch (out_of_range) { ^~~~~~~~~~~~ [...]/pv/subwindows/decoder_selector/item.cpp: In member function ‘QVariant pv::subwindows::decoder_selector::DecoderCollectionItem::data(int) const’: [...]/pv/subwindows/decoder_selector/item.cpp:88:11: warning: catching polymorphic type ‘class std::out_of_range’ by value [-Wcatch-value=] } catch (out_of_range) { ^~~~~~~~~~~~ --- diff --git a/pv/subwindows/decoder_selector/item.cpp b/pv/subwindows/decoder_selector/item.cpp index 00c469e0..417c5bfb 100644 --- a/pv/subwindows/decoder_selector/item.cpp +++ b/pv/subwindows/decoder_selector/item.cpp @@ -41,7 +41,7 @@ shared_ptr DecoderCollectionItem::subItem(int row) const { try { return subItems_.at(row); - } catch (out_of_range) { + } catch (out_of_range&) { return nullptr; } } @@ -85,7 +85,7 @@ QVariant DecoderCollectionItem::data(int column) const { try { return data_.at(column); - } catch (out_of_range) { + } catch (out_of_range&) { return QVariant(); } }