Merge branch 'main' into develop

This commit is contained in:
Linwood CI
2025-01-13 10:10:28 +00:00
6 changed files with 54 additions and 24 deletions

View File

@ -202,9 +202,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentPage.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentPage.fromJson(json);
} catch (e) {
return null;
}
}
@useResult
@ -308,8 +312,12 @@ final class NoteData extends ArchiveData<NoteData> {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentInfo.fromJson(json);
try {
final json = jsonDecode(content) as Map<String, dynamic>;
return DocumentInfo.fromJson(json);
} catch (e) {
return null;
}
}
@useResult
@ -331,7 +339,11 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
return NoteData.fromData(data);
try {
return NoteData.fromData(data);
} catch (e) {
return null;
}
}
@useResult
@ -361,9 +373,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ButterflyComponent.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ButterflyComponent.fromJson(json);
} catch (e) {
return null;
}
}
@useResult
@ -384,9 +400,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return TextStyleSheet.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return TextStyleSheet.fromJson(json);
} catch (e) {
return null;
}
}
@useResult
@ -420,9 +440,13 @@ final class NoteData extends ArchiveData<NoteData> {
if (data == null) {
return null;
}
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ColorPalette.fromJson(json);
try {
final content = utf8.decode(data);
final json = jsonDecode(content) as Map<String, dynamic>;
return ColorPalette.fromJson(json);
} catch (e) {
return null;
}
}
@useResult