Skip to content

Commit

Permalink
Null check for missing pathname
Browse files Browse the repository at this point in the history
This is causing a crash if someone whitelists just a protocol, ex `file://`
See #539
  • Loading branch information
purplecabbage authored Mar 13, 2019
1 parent 1d59304 commit 6e05357
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bin/templates/scripts/cordova/lib/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,9 @@ function parseWhitelistUrlForATS (url, options) {
var subdomain1 = '/*.'; // wildcard in hostname
var subdomain2 = '*://*.'; // wildcard in hostname and protocol
var subdomain3 = '*://'; // wildcard in protocol only
if (href.pathname.indexOf(subdomain1) === 0) {
if(!href.pathname) {
return null;
} else if (href.pathname.indexOf(subdomain1) === 0) {
retObj.NSIncludesSubdomains = true;
retObj.Hostname = href.pathname.substring(subdomain1.length);
} else if (href.pathname.indexOf(subdomain2) === 0) {
Expand Down

0 comments on commit 6e05357

Please sign in to comment.