mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix null pointer.
This commit is contained in:
parent
aad0864018
commit
7d6c8aa9dc
@ -30,7 +30,6 @@ use League\Fractal\Manager;
|
|||||||
use League\Fractal\Resource\Item;
|
use League\Fractal\Resource\Item;
|
||||||
use League\Fractal\Serializer\JsonApiSerializer;
|
use League\Fractal\Serializer\JsonApiSerializer;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AboutController
|
* Class AboutController
|
||||||
*/
|
*/
|
||||||
@ -44,7 +43,6 @@ class AboutController extends Controller
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -64,7 +62,6 @@ class AboutController extends Controller
|
|||||||
'php_version' => $phpVersion,
|
'php_version' => $phpVersion,
|
||||||
'os' => $phpOs,
|
'os' => $phpOs,
|
||||||
'driver' => $currentDriver,
|
'driver' => $currentDriver,
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->json(['data' => $data], 200)->header('Content-Type', 'application/vnd.api+json');
|
return response()->json(['data' => $data], 200)->header('Content-Type', 'application/vnd.api+json');
|
||||||
@ -84,5 +81,4 @@ class AboutController extends Controller
|
|||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@ use Preferences;
|
|||||||
*/
|
*/
|
||||||
class AccountController extends Controller
|
class AccountController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var CurrencyRepositoryInterface */
|
/** @var CurrencyRepositoryInterface */
|
||||||
private $currencyRepository;
|
private $currencyRepository;
|
||||||
/** @var AccountRepositoryInterface */
|
/** @var AccountRepositoryInterface */
|
||||||
@ -59,7 +58,7 @@ class AccountController extends Controller
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->middleware(
|
$this->middleware(
|
||||||
function ($request, $next) {
|
function ($request, $next) {
|
||||||
/** @var AccountRepositoryInterface repository */
|
// @var AccountRepositoryInterface repository
|
||||||
$this->repository = app(AccountRepositoryInterface::class);
|
$this->repository = app(AccountRepositoryInterface::class);
|
||||||
$this->repository->setUser(auth()->user());
|
$this->repository->setUser(auth()->user());
|
||||||
|
|
||||||
@ -74,7 +73,7 @@ class AccountController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param \FireflyIII\Models\Account $account
|
* @param \FireflyIII\Models\Account $account
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
@ -153,7 +152,7 @@ class AccountController extends Controller
|
|||||||
{
|
{
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
// if currency ID is 0, find the currency by the code:
|
// if currency ID is 0, find the currency by the code:
|
||||||
if ($data['currency_id'] === 0) {
|
if (0 === $data['currency_id']) {
|
||||||
$currency = $this->currencyRepository->findByCodeNull($data['currency_code']);
|
$currency = $this->currencyRepository->findByCodeNull($data['currency_code']);
|
||||||
$data['currency_id'] = is_null($currency) ? 0 : $currency->id;
|
$data['currency_id'] = is_null($currency) ? 0 : $currency->id;
|
||||||
}
|
}
|
||||||
@ -165,7 +164,6 @@ class AccountController extends Controller
|
|||||||
$resource = new Item($account, new AccountTransformer($this->parameters), 'accounts');
|
$resource = new Item($account, new AccountTransformer($this->parameters), 'accounts');
|
||||||
|
|
||||||
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -180,7 +178,7 @@ class AccountController extends Controller
|
|||||||
{
|
{
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
// if currency ID is 0, find the currency by the code:
|
// if currency ID is 0, find the currency by the code:
|
||||||
if ($data['currency_id'] === 0) {
|
if (0 === $data['currency_id']) {
|
||||||
$currency = $this->currencyRepository->findByCodeNull($data['currency_code']);
|
$currency = $this->currencyRepository->findByCodeNull($data['currency_code']);
|
||||||
$data['currency_id'] = is_null($currency) ? 0 : $currency->id;
|
$data['currency_id'] = is_null($currency) ? 0 : $currency->id;
|
||||||
}
|
}
|
||||||
|
@ -58,10 +58,12 @@ class TransactionJournalMetaFactory
|
|||||||
}
|
}
|
||||||
if (strlen($value) === 0) {
|
if (strlen($value) === 0) {
|
||||||
// don't store blank strings.
|
// don't store blank strings.
|
||||||
try {
|
if (!is_null($entry)) {
|
||||||
$entry->delete();
|
try {
|
||||||
} catch (Exception $e) { // @codeCoverageIgnore
|
$entry->delete();
|
||||||
Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage())); // @codeCoverageIgnore
|
} catch (Exception $e) { // @codeCoverageIgnore
|
||||||
|
Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage())); // @codeCoverageIgnore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
1
resources/assets/js/messages.js
vendored
1
resources/assets/js/messages.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user