From 095060ca7032837a7251bef37f24f1ceeb6831bb Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Sun, 22 Dec 2019 19:12:05 -0600 Subject: [PATCH] Avoid null pointer dereferences when generating code for initializers. These should have been harmless under ORCA/Pascal on the IIgs, assuming the code is otherwise functioning properly. --- Parser.pas | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Parser.pas b/Parser.pas index 3f265ea..7f9e492 100644 --- a/Parser.pas +++ b/Parser.pas @@ -3971,7 +3971,8 @@ var count := count - long(elements).lsw; if count = 0 then begin iPtr := iPtr^.next; - count := iPtr^.count; + if iPtr <> nil then + count := iPtr^.count; end; {if} end {if} else begin @@ -3981,7 +3982,8 @@ var count := count-1; if count = 0 then begin iPtr := iPtr^.next; - count := iPtr^.count; + if iPtr <> nil then + count := iPtr^.count; end; {if} end; {if} disp := disp+itype^.size; @@ -4043,9 +4045,11 @@ var count := count-1; if count = 0 then begin iPtr := iPtr^.next; - count := iPtr^.count; - bitsize := iPtr^.bitsize; - bitdisp := iPtr^.bitdisp; + if iPtr <> nil then begin + count := iPtr^.count; + bitsize := iPtr^.bitsize; + bitdisp := iPtr^.bitdisp; + end; {if} end; {if} end; {if} if union then