fix PHP Warning: Invalid argument supplied for foreach()

This commit is contained in:
Ralf Becker 2018-10-08 12:46:51 +02:00
parent 67aa825d33
commit ac9496343f

View File

@ -1505,12 +1505,16 @@ class Contacts extends Contacts\Storage
$type = null; $type = null;
} }
$title = $this->fileas($contact,$type); $title = $this->fileas($contact,$type);
$field_list = is_string($this->prefs['link_title_cf']) ? explode(',', $this->prefs['link_title_cf']) : $this->prefs['link_title_cf'];
foreach ($field_list as $field) if (!empty($this->prefs['link_title_cf']))
{ {
if($contact['#'.$field]) $field_list = is_string($this->prefs['link_title_cf']) ? explode(',', $this->prefs['link_title_cf']) : $this->prefs['link_title_cf'];
foreach ($field_list as $field)
{ {
$title .= ', ' . $contact['#'.$field]; if($contact['#'.$field])
{
$title .= ', ' . $contact['#'.$field];
}
} }
} }
return $title ; return $title ;