diff --git a/lib/hci-socket/gatt.js b/lib/hci-socket/gatt.js index 18dc52b..c5b2fe8 100644 --- a/lib/hci-socket/gatt.js +++ b/lib/hci-socket/gatt.js @@ -911,7 +911,9 @@ Gatt.prototype.handleWriteRequestOrCommand = function(request) { handleAttribute.emit('subscribe', this._mtu - 3, updateValueCallback); } } else { - handleAttribute.emit('unsubscribe'); + if (handleAttribute.emit) { + handleAttribute.emit('unsubscribe'); + } } result = ATT_ECODE_SUCCESS;