fix: error was shown on first app start

This commit is contained in:
korelstar 2018-08-16 17:09:34 +02:00
parent 88cfa4d29f
commit 73c6299c25
1 changed files with 8 additions and 6 deletions

View File

@ -67,12 +67,14 @@ class PageController extends Controller {
// check if notes folder is accessible
try {
$this->notesService->checkNotesFolder($this->userId);
// check if note exists
try {
$this->notesService->get($lastViewedNote, $this->userId);
} catch(\Exception $ex) {
$lastViewedNote = 0;
$errorMessage = $this->l10n->t('The last viewed note cannot be accessed. ').$ex->getMessage();
if($lastViewedNote) {
// check if note exists
try {
$this->notesService->get($lastViewedNote, $this->userId);
} catch(\Exception $ex) {
$lastViewedNote = 0;
$errorMessage = $this->l10n->t('The last viewed note cannot be accessed. ').$ex->getMessage();
}
}
} catch(\Exception $e) {
$errorMessage = $this->l10n->t('The notes folder is not accessible: %s', $e->getMessage());