Browse Source

FormattedText spans can be null.

Steven Kirk 8 years ago
parent
commit
e93e262f22
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/Skia/Avalonia.Skia/FormattedTextImpl.cs

+ 6 - 3
src/Skia/Avalonia.Skia/FormattedTextImpl.cs

@@ -47,11 +47,14 @@ namespace Avalonia.Skia
             _wrapping = wrapping;
             _constraint = constraint;
 
-            foreach (var span in spans)
+            if (spans != null)
             {
-                if (span.ForegroundBrush != null)
+                foreach (var span in spans)
                 {
-                    SetForegroundBrush(span.ForegroundBrush, span.StartIndex, span.Length);
+                    if (span.ForegroundBrush != null)
+                    {
+                        SetForegroundBrush(span.ForegroundBrush, span.StartIndex, span.Length);
+                    }
                 }
             }