From 9697d53a1527854536f8ddf5426f7ca902772f51 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Fri, 12 Feb 2021 17:06:20 +0100 Subject: [PATCH] Fixed bug in array swapping function ref #14 --- src/PdfCreator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PdfCreator.ts b/src/PdfCreator.ts index ce3d430..3b21eab 100644 --- a/src/PdfCreator.ts +++ b/src/PdfCreator.ts @@ -246,6 +246,10 @@ export class PdfCreator { return null; } - return [array[1], array[0]].concat(this.swapArrayPairs(array.slice(2))); + const rest = this.swapArrayPairs(array.slice(2)) + if (!rest) { + return [array[1], array[0]] + } + return [array[1], array[0]].concat(rest); } } \ No newline at end of file