فهرست منبع

Merge pull request #1485 from AvaloniaUI/fixes/geometryimpl-nre

Allow null pen in GeometryImpl.
Steven Kirk 7 سال پیش
والد
کامیت
2ffe8fafe3
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      src/Windows/Avalonia.Direct2D1/Media/GeometryImpl.cs

+ 2 - 2
src/Windows/Avalonia.Direct2D1/Media/GeometryImpl.cs

@@ -24,7 +24,7 @@ namespace Avalonia.Direct2D1.Media
         /// <inheritdoc/>
         public Rect GetRenderBounds(Avalonia.Media.Pen pen)
         {
-            return Geometry.GetWidenedBounds((float) (pen?.Thickness ?? 0)).ToAvalonia();
+            return Geometry.GetWidenedBounds((float)(pen?.Thickness ?? 0)).ToAvalonia();
         }
 
         /// <inheritdoc/>
@@ -48,7 +48,7 @@ namespace Avalonia.Direct2D1.Media
         /// <inheritdoc/>
         public bool StrokeContains(Avalonia.Media.Pen pen, Point point)
         {
-            return Geometry.StrokeContainsPoint(point.ToSharpDX(), (float)pen.Thickness);
+            return Geometry.StrokeContainsPoint(point.ToSharpDX(), (float)(pen?.Thickness ?? 0));
         }
 
         public ITransformedGeometryImpl WithTransform(Matrix transform)