From 19fbf42d3b76d5ef96fe22b39ad34bbdf92424e9 Mon Sep 17 00:00:00 2001 From: Matt Lane Date: Wed, 28 Sep 2016 15:09:19 -0700 Subject: [PATCH] Prevent TripleLift TypeError If `utils.getBidRequest` returns `undefined`, attemtping to access properties of `bidObj` raises a `TypeError`. --- src/adapters/triplelift.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/adapters/triplelift.js b/src/adapters/triplelift.js index 608a62d6cc5..6ea0e0d8ef4 100644 --- a/src/adapters/triplelift.js +++ b/src/adapters/triplelift.js @@ -76,10 +76,10 @@ var TripleLiftAdapter = function TripleLiftAdapter() { $$PREBID_GLOBAL$$.TLCB = function(tlResponseObj) { if (tlResponseObj && tlResponseObj.callback_id) { var bidObj = utils.getBidRequest(tlResponseObj.callback_id); - var placementCode = bidObj.placementCode; + var placementCode = bidObj && bidObj.placementCode; // @if NODE_ENV='debug' - utils.logMessage('JSONP callback function called for inventory code: ' + bidObj.params.inventoryCode); + if (bidObj) {utils.logMessage('JSONP callback function called for inventory code: ' + bidObj.params.inventoryCode);} // @endif var bid = []; @@ -97,7 +97,7 @@ var TripleLiftAdapter = function TripleLiftAdapter() { } else { //no response data // @if NODE_ENV='debug' - utils.logMessage('No prebid response from TripleLift for inventory code: ' + bidObj.params.inventoryCode); + if (bidObj) {utils.logMessage('No prebid response from TripleLift for inventory code: ' + bidObj.params.inventoryCode);} // @endif bid = bidfactory.createBid(2, bidObj); bid.bidderCode = 'triplelift';