Try to catch a null pointer.

This commit is contained in:
James Cole 2018-11-02 05:59:22 +01:00
parent bd0be97137
commit d85ccb6ab2

View File

@ -41,6 +41,7 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Log; use Log;
use Navigation; use Navigation;
use Symfony\Component\Debug\Exception\FatalThrowableError;
/** /**
* Class BudgetRepository. * Class BudgetRepository.
@ -104,7 +105,7 @@ class BudgetRepository implements BudgetRepositoryInterface
// delete limits with amount 0: // delete limits with amount 0:
try { try {
BudgetLimit::where('amount', 0)->delete(); BudgetLimit::where('amount', 0)->delete();
} catch (Exception $e) { } catch (Exception|FatalThrowableError $e) {
Log::debug(sprintf('Could not delete budget limit: %s', $e->getMessage())); Log::debug(sprintf('Could not delete budget limit: %s', $e->getMessage()));
} }
Budget::where('order',0)->update(['order' => 100]); Budget::where('order',0)->update(['order' => 100]);
@ -119,7 +120,7 @@ class BudgetRepository implements BudgetRepositoryInterface
// delete it! // delete it!
try { try {
BudgetLimit::find($budgetLimit->id)->delete(); BudgetLimit::find($budgetLimit->id)->delete();
} catch (Exception $e) { } catch (Exception|FatalThrowableError $e) {
Log::debug(sprintf('Could not delete budget limit: %s', $e->getMessage())); Log::debug(sprintf('Could not delete budget limit: %s', $e->getMessage()));
} }
} }