Skip to content

Commit

Permalink
Fix removeAdUnit (#4053)
Browse files Browse the repository at this point in the history
* Fix removeAdUnit

When there are multiple adUnits with the same code, only one of them gets removed. This fixes that.

* snapwich fix
  • Loading branch information
benjaminclot authored and snapwich committed Aug 9, 2019
1 parent 36d67b6 commit 6fb6049
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,12 +390,12 @@ $$PREBID_GLOBAL$$.removeAdUnit = function (adUnitCode) {
}

adUnitCodes.forEach((adUnitCode) => {
for (let i = 0; i < $$PREBID_GLOBAL$$.adUnits.length; i++) {
for (let i = $$PREBID_GLOBAL$$.adUnits.length - 1; i >= 0; i--) {
if ($$PREBID_GLOBAL$$.adUnits[i].code === adUnitCode) {
$$PREBID_GLOBAL$$.adUnits.splice(i, 1);
}
}
})
});
};

/**
Expand Down

0 comments on commit 6fb6049

Please sign in to comment.