Commit d41545dd authored by Robert Rollins's avatar Robert Rollins

Fixed a bug which caused the View renderer to crash on bad fields.

If the user specified a date field in the Show settings which didn't exist in one or more of the entities which passed through the View, the rendering process would crash. This should no longer be the case.
parent c301939d
......@@ -157,12 +157,15 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
$delta = isset($row->$delta_field) ? $row->$delta_field : 0;
if ($is_field) {
$items = field_get_items($this->entity_type, $entity, $field_name);
if (!$items) {
// This entity doesn't have the date field that the user configured our
// view to use. We can't do anything with it.
return;
}
$date_field = $items[$delta];
$domain = check_plain($_SERVER['SERVER_NAME']);
$entity->date_id[] = "calendar.$id.$field_name.$delta@$domain";
//$entity->date_id[] = 'calendar.' . $id . '.' . $field_name . '.' . $delta;
if (!empty($date_field['value'])) {
$start = new DateObject($date_field['value'], $date_field['timezone_db']);
if (array_key_exists('value2', $date_field)) {
......@@ -178,11 +181,6 @@ class date_ical_plugin_row_ical_entity extends views_plugin_row {
$end = new DateObject($date_field, $date_field['timezone_db']);
}
// If we don't have an iCal date value, go no further.
if (empty($start)) {
return;
}
// Set the item date to the proper display timezone.
$start->setTimezone(new dateTimezone($date_field['timezone']));
$end->setTimezone(new dateTimezone($date_field['timezone']));
......
......@@ -89,6 +89,12 @@ class date_ical_plugin_style_ical_feed extends views_plugin_style {
// Now add the vevents.
$timezones = array();
foreach ($rows as $row) {
if (empty($row)) {
// The row plugin returned NULL for this row, which can happen due to
// various error conditions. The only thing we can do is skip it.
continue;
}
$vevent = $vcalendar->newComponent('vevent');
// Get the start date as an array.
$rendered_date = $row['start']->toArray();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment