Skip to content

Commit

Permalink
Fixing null exception with some tracking pixels (#71)
Browse files Browse the repository at this point in the history
* Fixing null exception when some tracking pixels are loaded from different domain.

* Fixing linting errors.
  • Loading branch information
rohit-nair authored and soulgalore committed Jan 20, 2019
1 parent 189ec9d commit b95bf04
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,18 @@ module.exports = {
currentPage.headerSize += Math.max(entry.response.headersSize, 0);

const entryStart = new Date(entry.startedDateTime).getTime();
if (entryStart > pageTimings[entry.pageref].onLoad) {
if (
pageTimings[entry.pageref] &&
entryStart > pageTimings[entry.pageref].onLoad
) {
currentPage.afterOnLoad.requests += 1;
currentPage.afterOnLoad.transferSize += entry.response.bodySize;
collect.contentType(asset, currentPage.afterOnLoad.contentTypes);
}
if (entryStart > pageTimings[entry.pageref].onContentLoad) {
if (
pageTimings[entry.pageref] &&
entryStart > pageTimings[entry.pageref].onContentLoad
) {
currentPage.afterOnContentLoad.requests += 1;
currentPage.afterOnContentLoad.transferSize += entry.response.bodySize;
collect.contentType(asset, currentPage.afterOnContentLoad.contentTypes);
Expand Down

0 comments on commit b95bf04

Please sign in to comment.