Fix nullpointers.

This commit is contained in:
James Cole
2021-04-07 14:18:43 +02:00
parent c67b10e38d
commit 4f42eb1796
3 changed files with 10 additions and 5 deletions

View File

@@ -103,7 +103,7 @@ class EditController extends Controller
$repetition = $recurrence->recurrenceRepetitions()->first();
$currentRepType = $repetition->repetition_type;
if ('' !== $repetition->repetition_moment) {
$currentRepType .= ',' . $repetition->repetition_moment;
$currentRepType .= ',' . $repetition->repetition_moment;
}
// put previous url in session if not redirect from store (not "return_to_edit").
@@ -119,10 +119,10 @@ class EditController extends Controller
'times' => (string)trans('firefly.repeat_times'),
];
if (null !== $recurrence->repeat_until) {
$repetitionEnd = 'until_date';
$repetitionEnd = 'until_date';
}
if ($recurrence->repetitions > 0) {
$repetitionEnd = 'times';
$repetitionEnd = 'times';
}
$weekendResponses = [
@@ -140,7 +140,7 @@ class EditController extends Controller
'deposit_source_id' => $array['transactions'][0]['source_id'],
'withdrawal_destination_id' => $array['transactions'][0]['destination_id'],
];
$array['first_date'] = substr($array['first_date'], 0, 10);
$array['first_date'] = substr((string)$array['first_date'], 0, 10);
$array['repeat_until'] = substr((string)$array['repeat_until'], 0, 10);
$array['transactions'][0]['tags'] = implode(',', $array['transactions'][0]['tags'] ?? []);
@@ -177,7 +177,7 @@ class EditController extends Controller
}
if (count($this->attachments->getMessages()->get('attachments')) > 0) {
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
$request->session()->flash('info', $this->attachments->getMessages()->get('attachments'));
}
app('preferences')->mark();
$redirect = redirect($this->getPreviousUri('recurrences.edit.uri'));