Skip to content

Commit

Permalink
fixed Null Pointer
Browse files Browse the repository at this point in the history
fixes
>TypeError: Cannot read property 'host' of undefined`.

if somehow `window` gets created on the global scope.

For example:  See cometd/cometd-nodejs-client#17
  • Loading branch information
ChuckJonas authored May 1, 2019
1 parent 3f9e567 commit 865130c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (request.defaults) {
}

var baseUrl;
if (typeof window === 'undefined') {
if (typeof window === 'undefined' || typeof window.location === 'undefined' ) {
baseUrl = process.env.LOCATION_BASE_URL || "";
} else {
var apiHost = normalizeApiHost(window.location.host);
Expand Down

0 comments on commit 865130c

Please sign in to comment.