mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-01 04:07:53 +08:00
Note.load: lastModified can throw an exception
Fixes APP-V
This commit is contained in:
@ -165,9 +165,17 @@ class Note with NotesNotifier {
|
|||||||
|
|
||||||
final file = File(_filePath);
|
final file = File(_filePath);
|
||||||
if (_loadState == NoteLoadState.Loaded) {
|
if (_loadState == NoteLoadState.Loaded) {
|
||||||
var fileLastModified = file.lastModifiedSync();
|
try {
|
||||||
if (this.fileLastModified == fileLastModified) {
|
var fileLastModified = file.lastModifiedSync();
|
||||||
return _loadState;
|
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");
|
Log.d("Note modified: $_filePath");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user