mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Fix a few null pointers.
This commit is contained in:
@@ -25,7 +25,9 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class ParseDateString
|
||||
@@ -151,8 +153,13 @@ class ParseDateString
|
||||
*/
|
||||
protected function parseDefaultDate(string $date): Carbon
|
||||
{
|
||||
$result = Carbon::createFromFormat('Y-m-d', $date);
|
||||
if(false === $result) {
|
||||
$result = false;
|
||||
try {
|
||||
$result = Carbon::createFromFormat('Y-m-d', $date);
|
||||
} catch (InvalidFormatException $e) {
|
||||
Log::error(sprintf('parseDefaultDate("%s") ran into an error, but dont mind: %s', $date, $e->getMessage()));
|
||||
}
|
||||
if (false === $result) {
|
||||
$result = today(config('app.timezone'))->startOfDay();
|
||||
}
|
||||
return $result;
|
||||
|
Reference in New Issue
Block a user