Skip to content

Commit

Permalink
protect against TypeError: Cannot read property 'status' of null
Browse files Browse the repository at this point in the history
  • Loading branch information
iamigo committed Jul 10, 2017
1 parent d7beb45 commit 0ed3481
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cache/sampleStoreTimeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Timeout samples
*/
'use strict'; // eslint-disable-line strict
const logger = require('winston');
const sampleStore = require('./sampleStore');
const redisClient = require('./redisCache').client.sampleStore;
const isTimedOut = require('../db/helpers/sampleUtils').isTimedOut;
Expand Down Expand Up @@ -127,7 +128,8 @@ module.exports = {
const samples = [];
for (let num = 0; num < samplesCount; num++) {
const samp = redisResponses[num];
if (samp.status !== constants.statuses.Timeout) {
if (samp && samp.status &&
samp.status !== constants.statuses.Timeout) {
samples.push(samp);
}
}
Expand Down

0 comments on commit 0ed3481

Please sign in to comment.