Browse Source

fix null reference error

HOME 1 year ago
parent
commit
8421cccd6f
1 changed files with 2 additions and 0 deletions
  1. 2 0
      BsWidget/GdiPlusExt.cs

+ 2 - 0
BsWidget/GdiPlusExt.cs

@@ -25,6 +25,8 @@ namespace BsWidget
 
         public static SizeF DrawStringWithOutline(this Graphics g, string text, Font font, float x, float y, Color outlineColor, Color fillColor, float outlineWidth = 1)
         {
+            if (text == null) return SizeF.Empty;
+
             // assuming g is the Graphics object on which you want to draw the text
             using var p = new GraphicsPath();
             p.AddString(