From 0db0bf4880c2f69cde765ac3e653e5d2827e1fc3 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 23 Feb 2024 10:42:12 +0000 Subject: [PATCH] cactusjukebox: Fix floating point-to-string conversion error git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9254 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/cactusjukebox/source/cactusjukebox.lpi | 2 +- applications/cactusjukebox/source/mplayer.pas | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/applications/cactusjukebox/source/cactusjukebox.lpi b/applications/cactusjukebox/source/cactusjukebox.lpi index f0ff86663..aaa8a8414 100644 --- a/applications/cactusjukebox/source/cactusjukebox.lpi +++ b/applications/cactusjukebox/source/cactusjukebox.lpi @@ -18,7 +18,7 @@ - + diff --git a/applications/cactusjukebox/source/mplayer.pas b/applications/cactusjukebox/source/mplayer.pas index 5b72eb63e..f8f562d17 100644 --- a/applications/cactusjukebox/source/mplayer.pas +++ b/applications/cactusjukebox/source/mplayer.pas @@ -364,6 +364,7 @@ var tmps: string; i:integer; time: real; begin + result := -1; if GetMPlayerPlaying then begin i:=0; repeat begin @@ -375,11 +376,13 @@ begin until (pos('time_pos', tmps)>0) or (i>=3); i:=LastDelimiter('=', tmps); if i > 0 then begin - time:= StrToFloat(Copy(tmps, i+1, Length(tmps)), MPlayerFormatSettings); - time:=time*1000; - result:=round(time); - end else result:=-1; - end else result:=-1; + if TryStrToFloat(Copy(tmps, i+1, Length(tmps)), time, MPlayerFormatSettings) then + begin + time:=time*1000; + result:=round(time); + end; + end; + end; end; //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++