Prevent JS error in messages

This commit is contained in:
Rob Garrison 2019-01-27 18:37:12 -06:00
parent e8ba51f940
commit 1bdd0512ae

View File

@ -114,11 +114,13 @@ const msg = (() => {
continue;
}
const message = {data: dataObj, target};
requests.push(
tabSend(tab.id, message, options)
.then(unwrapData)
.catch(ignoreError)
);
if (tab && tab.id) {
requests.push(
tabSend(tab.id, message, options)
.then(unwrapData)
.catch(ignoreError)
);
}
}
return Promise.all(requests);
});