Browse Source

Prevent a crash for empty lines

Benedikt Stebner 2 years ago
parent
commit
1e646fd9a0
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs

+ 1 - 1
src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs

@@ -1438,7 +1438,7 @@ namespace Avalonia.Media.TextFormatting
 
             var lastRunIndex = _textRuns.Count - 1;
 
-            if (_textRuns[lastRunIndex] is TextEndOfLine && lastRunIndex > 0)
+            if (lastRunIndex > 0 && _textRuns[lastRunIndex] is TextEndOfLine)
             {
                 lastRunIndex--;
             }