Skip to content

Commit 3227083

Browse files
authored
Merge pull request #3 from kiran-axl/error-fix-null-values
Error fix null values
2 parents e88461d + 693d546 commit 3227083

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ViewsIcalHelper.php

+9-3
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,25 @@ protected function createDefaultEvent(ContentEntityInterface $entity, array $fie
3838
if (isset($field_mapping['summary_field'])) {
3939
/** @var \Drupal\Core\Field\FieldItemInterface $summary */
4040
$summary = $entity->{$field_mapping['summary_field']}->first();
41-
$event->setSummary($summary->getValue()['value']);
41+
if (!empty($summary)) {
42+
$event->setSummary($summary->getValue()['value']);
43+
}
4244
}
4345

4446
if (isset($field_mapping['location_field'])) {
4547
/** @var \Drupal\Core\Field\FieldItemInterface $location */
4648
$location = $entity->{$field_mapping['location_field']}->first();
47-
$event->setLocation($location->getValue()['value']);
49+
if (!empty($location)) {
50+
$event->setLocation($location->getValue()['value']);
51+
}
4852
}
4953

5054
if (isset($field_mapping['description_field'])) {
5155
/** @var \Drupal\Core\Field\FieldItemInterface $description */
5256
$description = $entity->{$field_mapping['description_field']}->first();
53-
$event->setDescription(\strip_tags($description->getValue()['value']));
57+
if (!empty($description)) {
58+
$event->setDescription(\strip_tags($description->getValue()['value']));
59+
}
5460
}
5561

5662
$event->setUseTimezone(TRUE);

0 commit comments

Comments
 (0)