fix: avoid another null pointer exception
This commit is contained in:
1 parent
185c8580c7
commit
6278dbe42a
1 file changed
+5
-1
@@ -175,8 +175,12 @@ class Destination implements TimestampableEntityInterface, SoftDeletableEntityIn
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPickup(int $id): ?Pickup
|
public function getPickup(?int $id): ?Pickup
|
||||||
{
|
{
|
||||||
|
if (null === $id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->getPickups() as $pickup) {
|
foreach ($this->getPickups() as $pickup) {
|
||||||
if ($id === $pickup['busProId']) {
|
if ($id === $pickup['busProId']) {
|
||||||
return Pickup::fromArray($pickup);
|
return Pickup::fromArray($pickup);
|
||||||
|
|||||||
Reference in new issue
Block a user