whoeevee / EeveeSpotify

A tweak to get Spotify Premium for free, just like Spotilife
1.48k stars 118 forks source link

[Issue] Crash when fetching some lyrics from LRCLIB #160

Closed hugeBlack closed 1 month ago

hugeBlack commented 1 month ago

Some timestamps of time-synced lyrics from LRCLIB cannot be matched with the regex in the LyricHelper.swift and cause crash.

For example, the first line in the lyric of song "Hope is the Thing With Feathers" by "Robin/HOYO-MiX/Chevy" is

[00:15] We rise together as our destiny unfolds

The regex is: https://github.com/whoeevee/EeveeSpotify/blob/3c282200403da60cf2934dabada0c0a8f4c5faa4/Sources/EeveeSpotify/Lyrics/Helpers/LyricsHelper.swift#L43

This regex fails to find match from this line since seconds has no decimal part and crashes the app with Fatal error: Unexpectedly found nil while unwrapping an Optional value

Changing this regex to

"\\[(?<minute>\\d{2}):(?<seconds>\\d{2}\\.?\\d*)\\] ?(?<content>.*)"

can solve this issue.

asdfzxcvbn commented 1 month ago

a PR would be appreciated