It may not be relevant, but I recently re-installed Delphi XE2.
I have a variable path
(of type TPath, a TMS Gogole maps thing, although I doubt that that is important).
I halt in the debugger and evaluate path
, which evaluates as Nil
.
If I run, I am getting an exception, Read of address 0
, which I suspect to be because of this.
When I then evaluate Assigned(path)
at the same time that path = Nil
it evolutes to True
(same result when I stop on the ShowMessage
line - which is executed)).
Can someone explain that to me?
Clean & rebuild changes nothing. Might it be better to remove & reinstall Delphi?
(apologies to @mbratch , I used var
for demo, the real name is actully path
)
[Update] Full code sample as provided by TMS and working for them (in a different tiem zone, which is why I ask here too).
This was retested here with:
uses
uwebgmapspolylines;
procedure TForm1.FormCreate(Sender: TObject);
var
p: TPath;
begin
p := TPath.Create;
if Assigned(p) then
ShowMessage('creation OK');
end;
and this proves the correct creation of TPath returns a valid instance.
When I stop at if Assigned(p) then
and evaluate p
I get Nil
, but when I evaluate Assigned(p)
I get True
.
When I hover the cursor over the variable declaration in the IDE, shows that the type is declared in UWebGMapsPolyLines
[Futher update] Two votes to close? Seriously? I guess from folks who think that this just can't be - and yet it is!!!
The strange thing is that @j tried it and got p <> Nil
. However, I tried it on a second PC and still get p = Nil
using the code posted here, which was provided by TMS.
I admit that it seems strange, but I can reproduce it on 2 PCs. P is Nil and yet it is Assigned().
I don't have the code of Assigend() to step into. Also, I changed the code slightly to explicitly if System.Assigned(p)
and still got the same result. Any suggestions?