Skip to content

Commit

Permalink
fix: handle empty file case
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierChanth committed Oct 8, 2024
1 parent 54c49e5 commit 0dd3caf
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ Future<List<AtsignInformation>> _getAtsignInformationFromFile([File? f]) async {
if (f == null) throw Exception("Failed to get the Atsign Information File");
try {
var contents = await f.readAsString();
if (contents.trim().isEmpty) return [];
var json = jsonDecode(contents);
if (json is! Iterable) {
return []; // The file format is invalid so return as a non-error and we will overwrite it
Expand Down

0 comments on commit 0dd3caf

Please sign in to comment.