[fpc-pascal] Get value of PPChar ?

Andrew Haines andrewd207 at aol.com
Sun Apr 16 17:22:16 CEST 2017


On 04/16/2017 10:58 AM, fredvs wrote:
> K, the function seems to work because the result = 0 (no error).
>
> But how to retrieve the data icy_meta (PPChar) ?
>
> var
> theicytag : PPChar;
> resu : integer;
> ...
>
> resu := mpg123_icy(ahandle, theicytag);
> if resu = 0 then writeln(theicytag^); --> raise exception + crash
>
> resu := mpg123_icy(ahandle, theicytag);
> if resu = 0 then writeln(theicytag^^); --> also raise exception + crash

You haven't checked if theicytag is nil. The call to mpg123_icy may 
succeed but still the tag may be nil.

resu := mpg123_icy(ahandle, theicytag);
if (resu = 0) and Assigned(theicytag) and Assigned(theicytag^)
then writeln(theicytag^);

Regards,

Andrew




More information about the fpc-pascal mailing list