Skip to content

Firefly III: a personal finances manager

Fix unauthenticated get default currency.

James Colefe00c4c3738c
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index aea73d2114..13f399e5cc 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -160,10 +160,12 @@ class Amount
public function getDefaultCurrency(): TransactionCurrency
{
- /** @var User $user */
- $user = auth()->user();
-
- return $this->getDefaultCurrencyByUserGroup($user->userGroup);
+ if(auth()->check()) {
+ /** @var User $user */
+ $user = auth()->user();
+ return $this->getDefaultCurrencyByUserGroup($user->userGroup);
+ }
+ return $this->getSystemCurrency();
}
public function getDefaultCurrencyByUserGroup(UserGroup $userGroup): TransactionCurrency