Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 3212

Access violation error Delphi 10.2

$
0
0

Dear Delphi users,

Recently I upgraded my old Delphi program based on Delphi XE4 (now I am using RAD Studio 10.2 Tokyo). I get ''access violation'' error, when I compile one of my existing codes. I copied the error message here:

'access violation at 0x00a12140: read of address 0x0000000d' Process Display.exe

I looked around for a couple of days in internet to find a solution for my problem, but unfortunately I could not find a solid solution. I copied also part of my code here:              

while (not SQLQuery.Eof) do begin   

    PtrSensor := GetSensorByID(SQLQuery.Fields.FieldByName('SensorNo').AsInteger);  


    if (PtrSensor nil) then begin    

        if (SQLQuery.Fields.FieldByName('LgIndex').AsInteger > MaxLgIndex) then begin       

            MaxLgIndex := SQLQuery.Fields.FieldByName('LgIndex').AsInteger;     

        end;      

        if (not PtrSensor^.Maintenance) then begin        

            SetLength(PtrSensor^.LG, Length(PtrSensor^.LG)+1);        

            with PtrSensor^.LG[High(PtrSensor^.LG)] do begin         

                Index := SQLQuery.Fields.FieldByName('LgIndex').AsInteger;         

                Value := SQLQuery.Fields.FieldByName('LgValue').AsInteger;         

                DruckStufe := SQLQuery.Fields.FieldByName('DruckStufe').AsInteger;      

            end;     

        end; 

    end;  

    SQLQuery.Next;

end;  

 

The debugger shows me that the error corresponds to the line ''if (not PtrSensor^.Maintenance) then begin". I think it cannot access the pointer's address. How can I solve this problem? I really appreciate any help.  

Best regards,

Moien      


Viewing all articles
Browse latest Browse all 3212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>