X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=bindings%2Fcxx%2Finclude%2Flibsigrok%2Flibsigrok.hpp;h=8c8b55495fa336999c825bd0490186fef807f658;hb=78132e2a138f707b9522c41110079f92b39afc88;hp=e16a9536279d4a9b1ced248214a2383a701b675b;hpb=2fe07d3fb521ac1aac6c1e8a6a8fc8d651b28a29;p=libsigrok.git diff --git a/bindings/cxx/include/libsigrok/libsigrok.hpp b/bindings/cxx/include/libsigrok/libsigrok.hpp index e16a9536..8c8b5549 100644 --- a/bindings/cxx/include/libsigrok/libsigrok.hpp +++ b/bindings/cxx/include/libsigrok/libsigrok.hpp @@ -148,6 +148,8 @@ public: shared_ptr > get_shared_pointer(Parent *parent) { + if (!parent) + throw Error(SR_ERR_BUG); this->parent = static_pointer_cast(parent->shared_from_this()); return shared_ptr >( this, reset_parent); @@ -155,6 +157,8 @@ public: shared_ptr > get_shared_pointer(shared_ptr parent) { + if (!parent) + throw Error(SR_ERR_BUG); this->parent = parent; return shared_ptr >( this, reset_parent); @@ -162,6 +166,8 @@ public: protected: static void reset_parent(StructureWrapper *object) { + if (!object->parent) + throw Error(SR_ERR_BUG); object->parent.reset(); }