Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Fix to prevent a null check from crashing the running node server. #287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/intervalBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ IntervalBuilder.prototype.determineInitialState = function(timestamp, callback)
};

IntervalBuilder.prototype.calculateDuration = function(check, begin, end, callback) {
// validate "check"; a null check will crash the server.
// Example: a null check will occur when a tag is removed from a check.
if (check == null) {
return;
}

var durationBegin = Math.max(begin, check.firstTested),
durationEnd = Math.min(end, check.lastTested),
duration = durationEnd - durationBegin;
Expand Down