fix: prevent null reference errors
This commit is contained in:
1 parent
1f3e79d57c
commit
61a8afdde7
1 file changed
+9
-1
@@ -46,6 +46,10 @@ class TravelController extends AbstractController
|
||||
{
|
||||
$travel = $this->loadCached($travelId, $hotelId);
|
||||
|
||||
if (null === $travel) {
|
||||
return new JsonResponse(['message' => 'Not found'], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
return $this->json($travel, Response::HTTP_OK, [], ['groups' => ['api:list', 'api:single']]);
|
||||
}
|
||||
|
||||
@@ -68,6 +72,10 @@ class TravelController extends AbstractController
|
||||
|
||||
$travel = $this->loadCached($travelId, $hotelId);
|
||||
|
||||
if (null === $travel) {
|
||||
return new JsonResponse(['message' => 'Not found'], Response::HTTP_NOT_FOUND);
|
||||
}
|
||||
|
||||
return $this->json($travel, Response::HTTP_OK, [], ['groups' => ['api:list', 'api:single']]);
|
||||
}
|
||||
|
||||
@@ -82,7 +90,7 @@ class TravelController extends AbstractController
|
||||
$travel = $this->travelXmlLoader->loadById($travelId, $hotelId);
|
||||
|
||||
if (null === $travel) {
|
||||
return new JsonResponse(['message' => 'Not found'], Response::HTTP_NOT_FOUND);
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->pickupXmlLoader->patchPickupsDetails($travel);
|
||||
|
||||
Reference in new issue
Block a user