Adds channel callbacks checking

This commit is contained in:
LAD Martin 2019-11-05 13:39:45 +00:00
parent 5a648fe2d8
commit 022bd87ac1
2 changed files with 5 additions and 2 deletions

View File

@ -218,7 +218,7 @@ public:
_readyCallback = callback;
// direct call if channel is already ready
if (_state == state_ready) callback();
if (_state == state_ready && callback) callback();
}
/**

View File

@ -73,7 +73,10 @@ void ChannelImpl::onError(const ErrorCallback &callback)
// if the channel is usable, all is ok
if (usable()) return;
// validity check
if (!callback) return;
// is the channel closing down?
if (_state == state_closing) return callback("Channel is closing down");