]> sigrok.org Git - pulseview.git/commitdiff
DecoderSelector: Fix catching polymorphic types by value.
authorUwe Hermann <redacted>
Thu, 14 Mar 2019 20:22:47 +0000 (21:22 +0100)
committerUwe Hermann <redacted>
Thu, 14 Mar 2019 21:49:24 +0000 (22:49 +0100)
  [...]/pv/subwindows/decoder_selector/item.cpp: In member function ‘std::shared_ptr<pv::subwindows::decoder_selector::DecoderCollectionItem> 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) {
             ^~~~~~~~~~~~

pv/subwindows/decoder_selector/item.cpp

index 00c469e062ceaea8f1c1a1e4a456ce6276aabad1..417c5bfbbe95e98d26448a0b02809de477c329c0 100644 (file)
@@ -41,7 +41,7 @@ shared_ptr<DecoderCollectionItem> 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();
        }
 }