How can I catch this Error or check to nil? lazarus / 62-General ---------------------------------------------------------------------- SunyD · 2017-03-15 21:31 Hello, i have following code from 3rd part: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$MODE DELPHI } // <--- it is compiled with Delphi-Mode // PDataSetRecInfo ist Pointer to Record TDataSetRecInfo// aBuffer is PChar// dsRecInfoOfs is Integer; //..        with PDataSetRecInfo(aBuffer + dsRecInfoOfs)^ do begin          riBookmarkFlag := bfCurrent;                     //sometimes error here          riRecNo := 0;        end;//..  Sometimes the programm crashs with Errorcode: = cannot access memory at adress 0x58 It tried without success: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$MODE DELPHI } // <--- it is compiled with Delphi-Mode     if PDataSetRecInfo(aBuffer + dsRecInfoOfs)<>nil then //don't helps, it passes every time        with PDataSetRecInfo(aBuffer + dsRecInfoOfs)^ do begin          riBookmarkFlag := bfCurrent;                       //sometimes error here          riRecNo := 0;        end;  Does anyone know how can I catch this Error or check to nil? ---------------------------------------------------------------------- ASerge · 2017-03-15 21:44 Quote from: Soner A. on March 15, 2017, 10:31:49 pm...or check to nil? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if aBuffer <> nil then ---------------------------------------------------------------------- SunyD · 2017-03-15 21:55 Thanks, so easy I didn't see it ---------------------------------------------------------------------- Ñuño_Martínez · 2017-03-17 18:43 Just to clarify: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i      if PDataSetRecInfo(aBuffer + dsRecInfoOfs)<>nil then //don't helps, it passes every timeThis doesn't help because NIL is a pointer to address x00000000, so NIL + anything <> NIL is TRUE in all cases. ---------------------------------------------------------------------- Kays · 2017-03-19 00:17 Quote from: ASerge on March 15, 2017, 10:44:50 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if aBuffer <> nil thenI like my code more descriptive:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if assigned(aBuffer) thenhttp://www.freepascal.org/docs- html/rtl/system/assigned.html