Skip to content

Commit e3b21df

Browse files
sandeepmistryrzr
authored andcommitted
Check if attribute handle supports emit before calling
Origin: noble#369 Change-Id: Icdc68c129ab7b165f5b30e15812e9d7316346146
1 parent bfb33fe commit e3b21df

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/hci-socket/gatt.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,9 @@ Gatt.prototype.handleWriteRequestOrCommand = function(request) {
911911
handleAttribute.emit('subscribe', this._mtu - 3, updateValueCallback);
912912
}
913913
} else {
914-
handleAttribute.emit('unsubscribe');
914+
if (handleAttribute.emit) {
915+
handleAttribute.emit('unsubscribe');
916+
}
915917
}
916918

917919
result = ATT_ECODE_SUCCESS;

0 commit comments

Comments
 (0)