Sfoglia il codice sorgente

Bugfix: exception when providing null content into the Text element

Marcin Ziąbek 4 anni fa
parent
commit
6f0c6513da
1 ha cambiato i file con 2 aggiunte e 1 eliminazioni
  1. 2 1
      QuestPDF/Fluent/ElementExtensions.cs

+ 2 - 1
QuestPDF/Fluent/ElementExtensions.cs

@@ -95,6 +95,7 @@ namespace QuestPDF.Fluent
 
         public static void Text(this IContainer element, object text, TextStyle? style = null)
         {
+            text ??= string.Empty;
             style ??= TextStyle.Default;
 
             if (element is Alignment alignment)
@@ -149,4 +150,4 @@ namespace QuestPDF.Fluent
             return condition ? element : new Container();
         }
     }
-}
+}