mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +08:00
NotesCache: Allow for json decoding errors
The file may have gotten corrupted.
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fimber/fimber.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_crashlytics/flutter_crashlytics.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:collection/collection.dart';
|
||||
|
||||
@ -104,7 +106,13 @@ class NotesCache {
|
||||
rethrow;
|
||||
}
|
||||
|
||||
try {
|
||||
return json.decode(contents).cast<String>();
|
||||
} catch (ex, st) {
|
||||
Fimber.e("Exception - $ex for contents: $contents");
|
||||
await FlutterCrashlytics().logException(ex, st);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
@visibleForTesting
|
||||
|
Reference in New Issue
Block a user