Note.load: lastModified can throw an exception

Fixes APP-V
This commit is contained in:
Vishesh Handa
2020-04-16 10:12:33 +02:00
parent bbaf5b4452
commit 21a7798dc9

View File

@ -165,9 +165,17 @@ class Note with NotesNotifier {
final file = File(_filePath);
if (_loadState == NoteLoadState.Loaded) {
var fileLastModified = file.lastModifiedSync();
if (this.fileLastModified == fileLastModified) {
return _loadState;
try {
var fileLastModified = file.lastModifiedSync();
if (this.fileLastModified == fileLastModified) {
return _loadState;
}
} on FileSystemException catch (e) {
if (e.osError.errorCode == 2 /* File Not Found */) {
_loadState = NoteLoadState.NotExists;
_notifyModified();
return _loadState;
}
}
Log.d("Note modified: $_filePath");
}