Skip to content

Commit 0ac3a07

Browse files
authored
ensure string (#117)
1 parent 825b090 commit 0ac3a07

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Types/Event.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ protected function location(Entry $event): ?string
144144

145145
$locationField = config("events.collections.$collectionHandle.location_field", 'location');
146146

147-
return $event->{$locationField};
147+
if (is_null($location = $event->{$locationField})) {
148+
return null;
149+
}
150+
151+
if (! is_string($location)) {
152+
return null;
153+
}
154+
155+
return $location;
148156
}
149157

150158
protected function supplement(CarbonInterface $date): ?Entry

0 commit comments

Comments
 (0)