Browse Source

Add handling for negative available space in Column layout planning

Marcin Ziąbek 8 months ago
parent
commit
3c48e30ca0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Source/QuestPDF/Elements/Column.cs

+ 4 - 0
Source/QuestPDF/Elements/Column.cs

@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Linq;
 using System.Linq;
 using QuestPDF.Drawing;
 using QuestPDF.Drawing;
+using QuestPDF.Helpers;
 using QuestPDF.Infrastructure;
 using QuestPDF.Infrastructure;
 
 
 namespace QuestPDF.Elements
 namespace QuestPDF.Elements
@@ -37,6 +38,9 @@ namespace QuestPDF.Elements
             if (CurrentRenderingIndex == Items.Count)
             if (CurrentRenderingIndex == Items.Count)
                 return SpacePlan.Empty();
                 return SpacePlan.Empty();
             
             
+            if (availableSpace.IsNegative())
+                return SpacePlan.Wrap("The available space is negative.");
+            
             var renderingCommands = PlanLayout(availableSpace);
             var renderingCommands = PlanLayout(availableSpace);
 
 
             if (!renderingCommands.Any())
             if (!renderingCommands.Any())