Skip to content

Commit

Permalink
fix: check for null before encoding json
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Dec 5, 2022
1 parent f5b2938 commit 0fd27b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Api/Serializer/DraftSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ protected function getDefaultAttributes($draft)
return [
'title' => $draft->title,
'content' => $draft->content,
'relationships' => json_decode($draft->relationships),
'extra' => json_decode($draft->extra),
'relationships' => $draft->relationships ? json_decode($draft->relationships) : null,
'extra' => $draft->extra ? json_decode($draft->extra) : null,
'scheduledValidationError' => $draft->scheduled_validation_error,
'scheduledFor' => $this->formatDate($draft->scheduled_for),
'updatedAt' => $this->formatDate($draft->updated_at),
Expand Down

0 comments on commit 0fd27b1

Please sign in to comment.