From b923a42f9ea91687dca3257a3af783b37b9d3b71 Mon Sep 17 00:00:00 2001 From: BobLd Date: Thu, 2 Apr 2020 19:55:27 +0100 Subject: [PATCH] Check if CurrentSubpath null before CloseSubpath --- .../Graphics/ContentStreamProcessor.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs index 4bfe7381..eff2248c 100644 --- a/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs +++ b/src/UglyToad.PdfPig/Graphics/ContentStreamProcessor.cs @@ -458,7 +458,7 @@ if (close) { - CurrentSubpath.CloseSubpath(); + CurrentSubpath?.CloseSubpath(); } ClosePath(); @@ -475,7 +475,7 @@ if (close) { - CurrentSubpath.CloseSubpath(); + CurrentSubpath?.CloseSubpath(); } ClosePath(); @@ -493,7 +493,7 @@ if (close) { - CurrentSubpath.CloseSubpath(); + CurrentSubpath?.CloseSubpath(); } ClosePath(); @@ -501,6 +501,11 @@ public void EndPath() { + if (CurrentPath == null) + { + return; + } + AddCurrentSubpath(); if (CurrentPath.IsClipping)