diff --git a/App/Processor/ContentParser/ResourceStack.cs b/App/Processor/ContentParser/ResourceStack.cs index 4c96f92..4e1bf82 100644 --- a/App/Processor/ContentParser/ResourceStack.cs +++ b/App/Processor/ContentParser/ResourceStack.cs @@ -9,13 +9,20 @@ sealed class ResourceStack readonly Stack _stack = new(); public ResourceStack(PdfDictionary pageResources) { - _stack.Push(pageResources); + if (pageResources is not null) { + _stack.Push(pageResources); + } } public PdfDictionary Current => _stack.Count != 0 ? _stack.Peek() : null; - public void Push(PdfDictionary res) => _stack.Push(res); - public void Pop() => _stack.Pop(); + public void Push(PdfDictionary res) { + if (res is not null) { + _stack.Push(res); + } + } + + public PdfDictionary Pop() => _stack.Pop(); public PdfDictionary LookupResource(PdfNames resourceType, string resName) { foreach (var layer in _stack) {