|
47 | 47 | m.top.posterURL = m.top.image.url |
48 | 48 | else |
49 | 49 | if isValid(m.top.json) |
50 | | - if isValid(m.top.json.ImageTags) and isValid(m.top.json.ImageTags.Primary) |
| 50 | + if isValid(m.top.json.ImageTags) and isValidAndNotEmpty(m.top.json.ImageTags.Primary) |
51 | 51 | imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ImageTags.Primary } |
52 | 52 | m.top.posterURL = ImageURL(m.top.json.id, "Primary", imgParams) |
53 | | - else if isValid(m.top.json.BackdropImageTags) and isValid(m.top.json.BackdropImageTags[0]) |
| 53 | + else if isValid(m.top.json.BackdropImageTags) and isValidAndNotEmpty(m.top.json.BackdropImageTags[0]) |
54 | 54 | imgParams = { "maxHeight": 440, "Tag": m.top.json.BackdropImageTags[0] } |
55 | 55 | m.top.posterURL = ImageURL(m.top.json.id, "Backdrop", imgParams) |
56 | | - else if isValid(m.top.json.ParentThumbImageTag) and isValid(m.top.json.ParentThumbItemId) |
| 56 | + else if isValidAndNotEmpty(m.top.json.ParentThumbImageTag) and isValid(m.top.json.ParentThumbItemId) |
57 | 57 | imgParams = { "maxHeight": 440, "maxWidth": 295, "Tag": m.top.json.ParentThumbImageTag } |
58 | 58 | m.top.posterURL = ImageURL(m.top.json.ParentThumbItemId, "Thumb", imgParams) |
| 59 | + else |
| 60 | + ' Set posterURL to empty string when no valid tags exist to prevent 404 requests |
| 61 | + m.top.posterURL = "" |
59 | 62 | end if |
60 | 63 |
|
61 | 64 | ' Add Backdrop Image |
62 | | - if isValid(m.top.json.BackdropImageTags) and isValid(m.top.json.BackdropImageTags[0]) |
| 65 | + if isValid(m.top.json.BackdropImageTags) and isValidAndNotEmpty(m.top.json.BackdropImageTags[0]) |
63 | 66 | imgParams = { "maxHeight": 720, "maxWidth": 1280, "Tag": m.top.json.BackdropImageTags[0] } |
64 | 67 | m.top.backdropURL = ImageURL(m.top.json.id, "Backdrop", imgParams) |
| 68 | + else |
| 69 | + ' Set backdropURL to empty string when no valid backdrop tags exist |
| 70 | + m.top.backdropURL = "" |
65 | 71 | end if |
| 72 | + else |
| 73 | + ' Set posterURL to empty string when json is invalid |
| 74 | + m.top.posterURL = "" |
66 | 75 | end if |
67 | 76 | end if |
68 | 77 | end sub |
|
0 commit comments