Skip to content

Commit c5d7df2

Browse files
committed
Fixed enumeration access
1 parent 3ebd117 commit c5d7df2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

PdfSharpCore/Drawing.Layout/XTextSegmentFormatter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ public XSize CalculateTextSize(IEnumerable<TextSegment> textSegments, double wid
147147

148148
ProcessTextSegments(textSegments, layoutRectangle, format, (block, dx, dy) => blocks.Add(block), true);
149149

150-
var height = blocks.Max(b => b.Location.Y);
150+
var height = blocks.Any()
151+
? blocks.Max(b => b.Location.Y)
152+
: 0;
151153
var maxLineHeight = 0.0;
152154
for (int i = blocks.Count - 1; i >= 0; i--)
153155
{

0 commit comments

Comments
 (0)