diff --git a/src/Fieldtypes/MailchimpAudience.php b/src/Fieldtypes/MailchimpAudience.php index d6552fa..0dd301f 100644 --- a/src/Fieldtypes/MailchimpAudience.php +++ b/src/Fieldtypes/MailchimpAudience.php @@ -21,10 +21,14 @@ protected function toItemArray($id) if (! $list = $this->callApi("lists/{$id}")) { return []; } - + + if (! $id = Arr::get($list, 'id')) { + return []; + } + return [ - 'id' => $list['id'], - 'title' => $list['name'], + 'id' => $id, + 'title' => Arr::get($list, 'name'), ]; } }