diff --git a/lib/plugins/pagexray/index.js b/lib/plugins/pagexray/index.js index 8f19ce11c..05e18edf5 100644 --- a/lib/plugins/pagexray/index.js +++ b/lib/plugins/pagexray/index.js @@ -128,15 +128,17 @@ export default class PageXrayPlugin extends SitespeedioPlugin { ); } } else { - pageSummary[0].statistics = this.pageXrayAggregator.summarizePerUrl( - message.url - ); - queue.postMessage( - make('pagexray.pageSummary', pageSummary[0], { - url: message.url, - group // TODO get the group from the URL? - }) - ); + // Check that we actually have one tested page + if (pageSummary.length > 0) { + pageSummary[0].statistics = + this.pageXrayAggregator.summarizePerUrl(message.url); + queue.postMessage( + make('pagexray.pageSummary', pageSummary[0], { + url: message.url, + group // TODO get the group from the URL? + }) + ); + } let iteration = 1; for (let summary of pageSummary) { queue.postMessage( diff --git a/lib/plugins/pagexray/pagexrayAggregator.js b/lib/plugins/pagexray/pagexrayAggregator.js index 1a4b8145f..041a3ade0 100644 --- a/lib/plugins/pagexray/pagexrayAggregator.js +++ b/lib/plugins/pagexray/pagexrayAggregator.js @@ -140,7 +140,8 @@ export class PageXrayAggregator { } } summarizePerUrl(url) { - return this.summarizePerObject(this.urls[url]); + // If we do not have a tested working page there's nothing to summarize + return this.urls[url] ? this.summarizePerObject(this.urls[url]) : {}; } summarize() { if (Object.keys(this.stats).length === 0) {