ITADN

Fix crash when lines are out of order by sorting

#872Pull Requestyodaluca23 创建于 2025-07-31已合并
Y
yodaluca23commented
This PR improves the `toSpotifyLyricsData(source:)` method in `LyricsDto` by sorting the lyrics lines by their timestamp (`offsetMs`) before mapping and serializing them into the `LyricsData` protobuf object. This closes #871 and https://github.com/SpotCompiled/SpotC-Plus-Plus/issues/74 ### Changes include: - Sorting `lines` array by `offsetMs` (treating `nil` as `0`) to ensure chronological order, and prevent crash. ## Why Sorting the lines ensures that the lyrics are in the correct order before trying to serialize them into the protobuf object. If Spotify tries to display unordered lyrics, it will often crash. ## Testing - Verified that lyrics with unordered timestamps are serialized in ascending order of `offsetMs`. - Confirmed that romanization still applies correctly. - Instrumental lyrics and translations remain unaffected.
合并状态:已合并 合并于 2025-08-02 关闭于 2025-08-02 0 条评论