Skip to content

Commit 2917d11

Browse files
author
protonate
committed
check array length when mapping sizes
1 parent d6fd130 commit 2917d11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sizeMapping.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function mapSizes(adUnit) {
1414
const mapping = adUnit.sizeMapping.reduce((prev, curr) => {
1515
return prev.minWidth < curr.minWidth ? curr : prev;
1616
});
17-
if(mapping.sizes) {
17+
if(mapping.sizes && mapping.sizes.length) {
1818
return mapping.sizes;
1919
}
2020
return adUnit.sizes;
@@ -23,7 +23,7 @@ function mapSizes(adUnit) {
2323
const mapping = adUnit.sizeMapping.find(sizeMapping =>{
2424
return width > sizeMapping.minWidth;
2525
});
26-
if(mapping && mapping.sizes){
26+
if(mapping && mapping.sizes && mapping.sizes.length){
2727
sizes = mapping.sizes;
2828
utils.logMessage(`AdUnit : ${adUnit.code} resized based on device width to : ${sizes}`);
2929
}

0 commit comments

Comments
 (0)