Skip to content

Commit

Permalink
fix broken timestamp on negative time prevention
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambada10 committed Nov 1, 2024
1 parent 412fafc commit 5d762bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/main/java/pl/lambada/songsync/util/LyricsUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ fun applyOffsetToLyrics(lyrics: String, offset: Int): String {

fun applyOffset(minute: Int, second: Int, millisecond: Int): String {
val totalMilliseconds = (minute * 60 * 1000) + (second * 1000) + (millisecond * 10) + offset
if (totalMilliseconds < 0) return "[00:00.000]" // Prevent negative times
if (totalMilliseconds < 0) return "00:00.000" // Prevent negative times

val newMinutes = (totalMilliseconds / 60000) % 60
val newSeconds = (totalMilliseconds / 1000) % 60
Expand Down

0 comments on commit 5d762bc

Please sign in to comment.