diff --git a/template.php b/template.php index f6eee48913151f50b8ef30e79118e7b838a6a227..51612883f0ea1e8d75141f4e481a0e8b65f88d80 100644 --- a/template.php +++ b/template.php @@ -89,15 +89,20 @@ function bluecheese_election_candidate_ballot_item($variables) { $candidate = $variables['candidate']; $account = user_load($candidate->uid); - $picture = theme('image_style', array( - 'style_name' => 'candidate_thumbnail', - 'path' => $candidate->field_election_picture[LANGUAGE_NONE][0]['uri'], - 'alt' => t('@user’s picture', array('@user' => format_username($account))), - 'attributes' => array( - 'title' => t('View user picture'), - 'class' => array('candidate-picture'), - ), - )); + if (!empty($candidate->field_election_picture)) { + $picture = theme('image_style', array( + 'style_name' => 'candidate_thumbnail', + 'path' => $candidate->field_election_picture[LANGUAGE_NONE][0]['uri'], + 'alt' => t('@user’s picture', array('@user' => format_username($account))), + 'attributes' => array( + 'title' => t('View user picture'), + 'class' => array('candidate-picture'), + ), + )); + } + else { + $picture = NULL; + } $full_name = theme('election_candidate_full_name', array('candidate' => $candidate)); $link = l($picture . $full_name, election_candidate_uri_path($candidate), array('html' => TRUE));