mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
try handling malformed operators where operands are not provided #355
This commit is contained in:
@@ -20,7 +20,7 @@ namespace UglyToad.PdfPig.Graphics
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Tokens;
|
using Tokens;
|
||||||
using UglyToad.PdfPig.Graphics.Operations.PathPainting;
|
using Operations.PathPainting;
|
||||||
|
|
||||||
internal class ReflectionGraphicsStateOperationFactory : IGraphicsStateOperationFactory
|
internal class ReflectionGraphicsStateOperationFactory : IGraphicsStateOperationFactory
|
||||||
{
|
{
|
||||||
@@ -271,8 +271,18 @@ namespace UglyToad.PdfPig.Graphics
|
|||||||
throw new InvalidOperationException($"Tried to create a move to next line and show text operation with operand type: {operands[0]?.GetType().Name ?? "null"}");
|
throw new InvalidOperationException($"Tried to create a move to next line and show text operation with operand type: {operands[0]?.GetType().Name ?? "null"}");
|
||||||
}
|
}
|
||||||
case MoveToNextLineWithOffset.Symbol:
|
case MoveToNextLineWithOffset.Symbol:
|
||||||
|
if (operands.Count < 2)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new MoveToNextLineWithOffset(OperandToDecimal(operands[0]), OperandToDecimal(operands[1]));
|
return new MoveToNextLineWithOffset(OperandToDecimal(operands[0]), OperandToDecimal(operands[1]));
|
||||||
case MoveToNextLineWithOffsetSetLeading.Symbol:
|
case MoveToNextLineWithOffsetSetLeading.Symbol:
|
||||||
|
if (operands.Count < 2)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new MoveToNextLineWithOffsetSetLeading(OperandToDecimal(operands[0]), OperandToDecimal(operands[1]));
|
return new MoveToNextLineWithOffsetSetLeading(OperandToDecimal(operands[0]), OperandToDecimal(operands[1]));
|
||||||
case PaintShading.Symbol:
|
case PaintShading.Symbol:
|
||||||
return new PaintShading((NameToken)operands[0]);
|
return new PaintShading((NameToken)operands[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user