From 866d95c9459296c14fccb355a385b802e579092c Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Sun, 26 Apr 2020 10:23:42 -0400 Subject: [PATCH] Check for SB being avail before filing #668 (#669) --- app/Http/Controllers/Frontend/PirepController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Frontend/PirepController.php b/app/Http/Controllers/Frontend/PirepController.php index 2395638b..f0f273c1 100644 --- a/app/Http/Controllers/Frontend/PirepController.php +++ b/app/Http/Controllers/Frontend/PirepController.php @@ -350,10 +350,11 @@ class PirepController extends Controller if ($request->has('sb_id')) { $brief = SimBrief::find($request->input('sb_id')); - - /** @var SimBriefService $sbSvc */ - $sbSvc = app(SimBriefService::class); - $sbSvc->attachSimbriefToPirep($pirep, $brief); + if ($brief !== null) { + /** @var SimBriefService $sbSvc */ + $sbSvc = app(SimBriefService::class); + $sbSvc->attachSimbriefToPirep($pirep, $brief); + } } // Depending on the button they selected, set an initial state