mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 19:09:23 +02:00
* correctly handle AsString if Nil had been passed to Make
git-svn-id: trunk@36983 -
This commit is contained in:
parent
31f5836e06
commit
a03b9d0fc4
@ -712,18 +712,18 @@ begin
|
||||
end;
|
||||
|
||||
function TValue.AsString: string;
|
||||
var
|
||||
s: string;
|
||||
begin
|
||||
case Kind of
|
||||
tkSString:
|
||||
s := PShortString(FData.FValueData.GetReferenceToRawData)^;
|
||||
tkAString:
|
||||
s := PAnsiString(FData.FValueData.GetReferenceToRawData)^;
|
||||
if (Kind in [tkSString, tkAString, tkUString, tkWString]) and not Assigned(FData.FValueData) then
|
||||
Result := ''
|
||||
else
|
||||
raise EInvalidCast.Create(SErrInvalidTypecast);
|
||||
end;
|
||||
result := s;
|
||||
case Kind of
|
||||
tkSString:
|
||||
Result := PShortString(FData.FValueData.GetReferenceToRawData)^;
|
||||
tkAString:
|
||||
Result := PAnsiString(FData.FValueData.GetReferenceToRawData)^;
|
||||
else
|
||||
raise EInvalidCast.Create(SErrInvalidTypecast);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TValue.AsExtended: Extended;
|
||||
|
Loading…
Reference in New Issue
Block a user