Skip to content

Commit

Permalink
Prevent Sovrn TypeError (#664)
Browse files Browse the repository at this point in the history
If `find` returns `undefined`, attempting to access properties of `missing` will throw a TypeError.
  • Loading branch information
matthewlane authored and Nate Cozi committed Sep 30, 2016
1 parent cab2b21 commit 4b150bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/adapters/sovrn.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ var SovrnAdapter = function SovrnAdapter() {
}

function addBlankBidResponses(impidsWithBidBack) {
var missing = $$PREBID_GLOBAL$$._bidsRequested.find(bidSet => bidSet.bidderCode === 'sovrn').bids
.filter(bid => impidsWithBidBack.indexOf(bid.bidId) < 0);
var missing = $$PREBID_GLOBAL$$._bidsRequested.find(bidSet => bidSet.bidderCode === 'sovrn');
if (missing) {
missing = missing.bids.filter(bid => impidsWithBidBack.indexOf(bid.bidId) < 0);
} else {
missing = [];
}

missing.forEach(function (bidRequest) {
// Add a no-bid response for this bid request.
Expand Down

0 comments on commit 4b150bf

Please sign in to comment.