[JENKINS-47368-master] prevent npe when no window.location
@@ -10,10 +10,16 @@ const organization = blueocean.organization || {};
// any all features added by ?features=SOMETHING,SOMETHING_ELSE
const pfx = 'features=';
const pfxlen = pfx.length;
-(window.location.href.split('?')[1] || '').split('&')
+const condition = window && window.location && window.location.href && window.location.href.split instanceof Function &&
+ window.location.href.split('?').length > 0;
+const query = condition ? window.location.href.split('?')[1] : undefined;
+if (query) {
+ query.split('&')
.forEach(p => p.startsWith(pfx)
- && (p.substring(pfxlen).split(',').forEach(f => { features[f] = true; })));
-
+ && (p.substring(pfxlen).split(',').forEach(f => {
+ features[f] = true;
+ })));
+}
export default {
loadUrls() {
try {
