d2syn, prevent possible unsafe access to curr range

(maybe #339)
This commit is contained in:
Basile Burg 2018-07-01 15:47:05 +02:00
parent a0bc73c705
commit ba80b6e828
1 changed files with 4 additions and 1 deletions

View File

@ -974,6 +974,8 @@ var
begin
inherited SetRange(value);
stored := TSynD2SynRange(CodeFoldRange.RangeType);
if not assigned(fCurrRange) or not Assigned(stored) then
exit;
fCurrRange.copyFrom(stored);
end;
@ -982,7 +984,8 @@ var
stored: TSynD2SynRange;
begin
stored := TSynD2SynRange(inherited GetRange);
if (stored = nil) then stored := TSynD2SynRange.Create(nil);
if (stored = nil) then
stored := TSynD2SynRange.Create(nil);
stored.copyFrom(fCurrRange);
//
CodeFoldRange.RangeType := Pointer(stored);