Browse Source

Merge pull request #10725 from Gillibald/fixes/tabOutOfRange

[Text] Fix potential index out of range exception
release/11.0.0-preview6
Dan Walmsley 3 years ago
committed by GitHub
parent
commit
a613f77d0b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Skia/Avalonia.Skia/TextShaperImpl.cs
  2. 2
      src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs

2
src/Skia/Avalonia.Skia/TextShaperImpl.cs

@ -72,7 +72,7 @@ namespace Avalonia.Skia
var glyphOffset = GetGlyphOffset(glyphPositions, i, textScale);
if (textSpan[i] == '\t')
if (i < textSpan.Length && textSpan[i] == '\t')
{
glyphIndex = typeface.GetGlyph(' ');

2
src/Windows/Avalonia.Direct2D1/Media/TextShaperImpl.cs

@ -68,7 +68,7 @@ namespace Avalonia.Direct2D1.Media
var glyphOffset = GetGlyphOffset(glyphPositions, i, textScale);
if (textSpan[i] == '\t')
if (i < textSpan.Length && textSpan[i] == '\t')
{
glyphIndex = typeface.GetGlyph(' ');

Loading…
Cancel
Save