You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Occasionally, when I attempt to .close a PlatformSender, I get an error:
TypeError: Cannot read property 'close' of null
at PlatformSender.close (/Users/ariporad/dev/project/node_modules/castv2-client/lib/senders/platform.js:66:14)
at Object.die (/Users/ariporad/dev/project/Bridge.js:30:12)
at Browser.<anonymous> (/Users/ariporad/dev/project/castbridge.js:17:31)
at emitTwo (events.js:106:13)
at Browser.emit (events.js:191:7)
at Browser.on_service_changed (/Users/ariporad/dev/project/node_modules/mdns/lib/browser.js:79:14)
at SocketWatcher.MDNSService.self.watcher.callback (/Users/ariporad/dev/project/node_modules/mdns/lib/mdns_service.js:18:40)
I've traced this back to here. After some debugging, it would seem that platformSender.client is null, for some reason.
Any ideas on why this might be occurring? For now, I'm just checking if platformSender.client != null before I close it.
Thanks!
The text was updated successfully, but these errors were encountered:
This happens here, when the platform sender closes its parent class, which sets its client to null. Have you tried catching errors on the platform sender ? If not try it. Else it could be useful to emit a close event on the sender, but it's kind of strange as normally all cases can be properly handled with the existing events.
const Client = require('castv2-client').Client;
const client = new Client();
...
client.getStatus(() => {...}) // <-- Can throw "Cannot read property 'getStatus' of null"
TypeError: Cannot read property 'getStatus' of null
at PlatformSender.getStatus (.../node_modules/castv2-client/lib/senders/platform.js:70:17)
...
This is likely due to this line in the same function @thibauts mentions.
I would want to listen to a close event, so I could know if the internal client closed itself for some reason.
But I guess I could also subscribe to the "inner client" like this:
Hi,
Occasionally, when I attempt to
.close
aPlatformSender
, I get an error:I've traced this back to here. After some debugging, it would seem that
platformSender.client
isnull
, for some reason.Any ideas on why this might be occurring? For now, I'm just checking if
platformSender.client != null
before I close it.Thanks!
The text was updated successfully, but these errors were encountered: