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
This commit is contained in:
gbamber
2016-03-17 11:25:18 +00:00
parent 26c1d45d87
commit 8b9871c84d

View File

@ -139,7 +139,13 @@ procedure Tplaysound.Execute;
begin begin
if not FileExistsUTF8(fPathToSoundFile) then if not FileExistsUTF8(fPathToSoundFile) then
Exit; Exit;
PlaySound(fPathToSoundFile); Try
PlaySound(fPathToSoundFile);
Except
On E: Exception do
E.CreateFmt(C_UnableToPlay +
'%s Message:%s', [fPathToSoundFile, E.Message]);
end;
end; end;
procedure Tplaysound.PlaySound(const szSoundFilename: string); procedure Tplaysound.PlaySound(const szSoundFilename: string);