* Patch from Mattias Gaertner to avoid some non-set function results

git-svn-id: trunk@34096 -
This commit is contained in:
michael 2016-07-11 11:43:36 +00:00
parent d36e882d1a
commit 1606976cfa

View File

@ -80,25 +80,33 @@ end;
function TJSValue.GetAsNumber: TJSNumber; function TJSValue.GetAsNumber: TJSNumber;
begin begin
If (ValueType=jstNumber) then If (ValueType=jstNumber) then
Result:=FValue.F; Result:=FValue.F
else
Result:=0.0;
end; end;
function TJSValue.GetAsObject: TObject; function TJSValue.GetAsObject: TObject;
begin begin
If (ValueType=jstObject) then If (ValueType=jstObject) then
Result:=TObject(FValue.P); Result:=TObject(FValue.P)
else
Result:=nil;
end; end;
function TJSValue.GetAsReference: TObject; function TJSValue.GetAsReference: TObject;
begin begin
If (ValueType=jstReference) then If (ValueType=jstReference) then
Result:=TObject(FValue.P); Result:=TObject(FValue.P)
else
Result:=nil;
end; end;
function TJSValue.GetAsString: TJSString; function TJSValue.GetAsString: TJSString;
begin begin
If (ValueType=jstString) then If (ValueType=jstString) then
Result:=String(FValue.P); Result:=String(FValue.P)
else
Result:='';
end; end;
function TJSValue.GetIsNull: Boolean; function TJSValue.GetIsNull: Boolean;