Skip to content
This repository has been archived by the owner on May 22, 2020. It is now read-only.

Commit

Permalink
Fix error stemming from port discovery refactor (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
HarsimranSingh authored Jul 27, 2018
1 parent 0dbc966 commit bae2748
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/browser/port_discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export class PortDiscovery extends EventEmitter {
// TODO: provide a unix implementation
}

this._transport.on('message', (s: any, data: string) => {
this.emit(route.runtime('launched'), JSON.parse(data));
});
if (this._transport) {
this._transport.on('message', (s: any, data: string) => {
this.emit(route.runtime('launched'), JSON.parse(data));
});
}
}

return this._transport;
Expand Down Expand Up @@ -75,7 +77,9 @@ export class PortDiscovery extends EventEmitter {
const transport = this.constructTransport();

coreState.setSocketServerState(portDiscoveryPayload);
transport.publish(portDiscoveryPayload);
if (transport) {
transport.publish(portDiscoveryPayload);
}

if (portDiscoveryPayload.runtimeInformationChannel) {
const namedPipeTransport = new ChromiumIPC(portDiscoveryPayload.runtimeInformationChannel);
Expand Down

0 comments on commit bae2748

Please sign in to comment.