Skip to content

Commit

Permalink
Fix error when there is no media
Browse files Browse the repository at this point in the history
  • Loading branch information
aledeg committed May 4, 2023
1 parent 229146d commit 8eece3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Transformer/InsertTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function transform($entry) {
try {
$jsonResponse = file_get_contents("{$content->getCommentsLink()}.json");
$arrayResponse = json_decode($jsonResponse, true);
$pictures = $arrayResponse[0]['data']['children'][0]['data']['media_metadata'];
$pictures = $arrayResponse[0]['data']['children'][0]['data']['media_metadata'] ?? null;
if (!empty($pictures)) {
$images = [];
foreach ($pictures as $id => $metadata) {
Expand Down

0 comments on commit 8eece3a

Please sign in to comment.