Ensure port instance exists when waiting for connection requests

This commit is contained in:
Raymond Hill 2020-09-01 09:53:35 -04:00
parent 90743532f1
commit 9ab631b4c4
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 2 additions and 1 deletions

View File

@ -151,8 +151,9 @@ vAPI.MessagingConnection = class {
static addListener(listener) {
listeners.add(listener);
vAPI.messaging.getPort(); // Ensure a port instance exists
}
static async connectTo(from, to, handler) {
static connectTo(from, to, handler) {
const port = vAPI.messaging.getPort();
if ( port === null ) { return; }
const connection = new vAPI.MessagingConnection(handler, {