code review

This commit is contained in:
gorhill 2014-09-14 18:23:12 -04:00
parent fa88ba77fd
commit 1e464ccb4a
1 changed files with 1 additions and 2 deletions

View File

@ -201,8 +201,7 @@ var onDisconnect = function(port) {
listener(msg, port.sender, nullFunc);
// Cleanup port if no longer in use.
port = nameToPortMap[port.name];
if ( port ) {
if ( nameToPortMap.hasOwnProperty(port.name) ) {
delete nameToPortMap[port.name];
port.onMessage.removeListener(onMessage);
port.onDisconnect.removeListener(onDisconnect);