From 8b9871c84d1e5c75e6b5e42f63260dff37d92531 Mon Sep 17 00:00:00 2001 From: gbamber Date: Thu, 17 Mar 2016 11:25:18 +0000 Subject: [PATCH] Added Try-Except to Execute in case sound is unplayable git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4566 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/playsoundpackage/uplaysound.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/playsoundpackage/uplaysound.pas b/components/playsoundpackage/uplaysound.pas index c287be84c..774beaa20 100644 --- a/components/playsoundpackage/uplaysound.pas +++ b/components/playsoundpackage/uplaysound.pas @@ -139,7 +139,13 @@ procedure Tplaysound.Execute; begin if not FileExistsUTF8(fPathToSoundFile) then Exit; - PlaySound(fPathToSoundFile); + Try + PlaySound(fPathToSoundFile); + Except + On E: Exception do + E.CreateFmt(C_UnableToPlay + + '%s Message:%s', [fPathToSoundFile, E.Message]); + end; end; procedure Tplaysound.PlaySound(const szSoundFilename: string);