Skip to content

Commit

Permalink
fix: parse correctly the null character
Browse files Browse the repository at this point in the history
Some ID3v2 have an \0 null character as a year. `int.parse()`throws an exception if it can't translate the string into an integer.
  • Loading branch information
ClementBeal committed Dec 2, 2024
1 parent 78e8c79 commit 81e661f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/src/parsers/id3v2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ class ID3v2Parser extends TagParser {

// 10 -> frame header
offset = offset + 10 + frame.size;

processFrame(frame.id, frame.size);
}

Expand Down Expand Up @@ -674,7 +673,7 @@ class ID3v2Parser extends TagParser {
return tagIdentity == "TAG";
}

int _parseYear(String year) {
int? _parseYear(String year) {
if (year.contains("-")) {
return int.parse(year.split("-").first);
} else if (year.contains("/")) {
Expand Down

0 comments on commit 81e661f

Please sign in to comment.