Skip to content

Commit

Permalink
null check banner.h (prebid#1142)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aadeshp authored and guscarreon committed Dec 12, 2019
1 parent eee0644 commit dd912fc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"mockBidRequest": {
"id": "test-req-id",
"imp": [
{
"id": "1",
"banner": {
"format": [
{
"w": 640
}
],
"w": 640
},
"ext": {
"bidder": {
"placementId": "plmt1",
"publisherId": "pub1"
}
}
}
],
"site": {
"domain": "prebid.org",
"page": "prebid.org"
},
"device": {
"ip": "152.193.6.74"
},
"user": {
"id": "db089de9-a62e-4861-a881-0ff15e052516",
"buyeruid": "v4_bidder_token"
},
"tmax": 500
},
"expectedMakeRequestsErrors": [
{
"value": "imp #1: banner height required",
"comparison": "literal"
}
]
}
6 changes: 6 additions & 0 deletions adapters/audienceNetwork/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ func (this *FacebookAdapter) modifyImp(out *openrtb.Imp) error {
return nil
}

if out.Banner.H == nil {
return &errortypes.BadInput{
Message: fmt.Sprintf("imp #%s: banner height required", out.ID),
}
}

if _, ok := supportedBannerHeights[*out.Banner.H]; !ok {
return &errortypes.BadInput{
Message: fmt.Sprintf("imp #%s: only banner heights 50 and 250 are supported", out.ID),
Expand Down

0 comments on commit dd912fc

Please sign in to comment.