mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 02:44:58 +08:00
Check if CurrentSubpath is null in CloseSubpath()
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
public PdfPoint CloseSubpath()
|
||||
public PdfPoint? CloseSubpath()
|
||||
{
|
||||
return new PdfPoint();
|
||||
}
|
||||
|
@@ -419,8 +419,13 @@
|
||||
CurrentSubpath = new PdfSubpath();
|
||||
}
|
||||
|
||||
public PdfPoint CloseSubpath()
|
||||
public PdfPoint? CloseSubpath()
|
||||
{
|
||||
if (CurrentSubpath == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
PdfPoint point;
|
||||
if (CurrentSubpath.Commands[0] is Move move)
|
||||
{
|
||||
|
@@ -89,7 +89,7 @@
|
||||
/// <summary>
|
||||
/// Close the current subpath.
|
||||
/// </summary>
|
||||
PdfPoint CloseSubpath();
|
||||
PdfPoint? CloseSubpath();
|
||||
|
||||
/// <summary>
|
||||
/// Add the current subpath to the path.
|
||||
|
@@ -29,7 +29,11 @@
|
||||
/// <inheritdoc />
|
||||
public void Run(IOperationContext operationContext)
|
||||
{
|
||||
operationContext.CurrentPosition = operationContext.CloseSubpath();
|
||||
var point = operationContext.CloseSubpath();
|
||||
if (point.HasValue)
|
||||
{
|
||||
operationContext.CurrentPosition = point.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
Reference in New Issue
Block a user