From 6f95e9a3cbf07984bc2b1cb2bd82a3d691209ab1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 12 Mar 2016 07:17:00 +0100 Subject: [PATCH] Fix some decrypt bugs. --- app/Models/TransactionJournal.php | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 64545d5177..1a60632da9 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -46,17 +46,16 @@ use Watson\Validating\ValidatingTrait; * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal before($date) * @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\TransactionJournal transactionTypes($types) * - * @property-read string $transaction_type_type - * @property-read string $transaction_currency_code - * @property-read string $destination_amount - * @property-read string $destination_account_id - * @property-read string $destination_account_name - * @property-read string $destination_account_type - * @property-read string $source_amount - * @property-read string $source_account_id - * @property-read string $source_account_name - * @property-read string $source_account_type - + * @property-read string $transaction_type_type + * @property-read string $transaction_currency_code + * @property-read string $destination_amount + * @property-read string $destination_account_id + * @property-read string $destination_account_name + * @property-read string $destination_account_type + * @property-read string $source_amount + * @property-read string $source_account_id + * @property-read string $source_account_name + * @property-read string $source_account_type * */ class TransactionJournal extends TransactionJournalSupport @@ -186,7 +185,11 @@ class TransactionJournal extends TransactionJournalSupport */ public function getDestinationAccountNameAttribute($value) { - return Crypt::decrypt($value); + if (!is_null($value) && strlen(strval($value)) > 0) { + return Crypt::decrypt($value); + } + + return null; } /** @@ -213,7 +216,12 @@ class TransactionJournal extends TransactionJournalSupport */ public function getSourceAccountNameAttribute($value) { - return Crypt::decrypt($value); + if (!is_null($value) && strlen(strval($value)) > 0) { + return Crypt::decrypt($value); + } + + return null; + } /**