diff --git a/include/amqpcpp/channel.h b/include/amqpcpp/channel.h index f30922a..ca2814c 100644 --- a/include/amqpcpp/channel.h +++ b/include/amqpcpp/channel.h @@ -22,7 +22,7 @@ class Channel private: /** * The implementation for the channel - * @var std::unique_ptr + * @var std::shared_ptr */ std::shared_ptr _implementation; @@ -58,7 +58,8 @@ public: virtual ~Channel() { // close the channel (this will eventually destruct the channel) - _implementation->close(); + // note that the channel may be in an invalid state in case it was moved, hence the "if" + if (_implementation) _implementation->close(); } /**