cocoa: adding a check for TCocoaTextLayout.Draw procedure. Do nothing if string is empty or invalid. Prevents SynEdit crashes for unicode characters

git-svn-id: trunk@59196 -
This commit is contained in:
dmitry 2018-09-30 20:14:02 +00:00
parent bbd07791c8
commit 7e97caf04a

View File

@ -1349,6 +1349,10 @@ var
I, Count: NSUInteger;
transform : NSAffineTransform;
begin
Range := FLayout.glyphRangeForTextContainer(FTextContainer);
if Range.length = 0 then
Exit; // cannot render anything. string is empty or invalid characters
if not ctx.isFlipped then
Context := NSGraphicsContext.graphicsContextWithGraphicsPort_flipped(ctx.graphicsPort, True)
else
@ -1369,7 +1373,6 @@ begin
transform.concat;
end;
Range := FLayout.glyphRangeForTextContainer(FTextContainer);
Pt.x := X;
Pt.y := Y;
if Assigned(DX) then