From 7b9012bc552bf190ef75bab14be0106b1de39fb8 Mon Sep 17 00:00:00 2001 From: Chris Isom Date: Thu, 3 May 2018 17:06:24 -0700 Subject: [PATCH] this fixes a null error I was getting on line 116 which was breaking my export, this null check fixes it and keeps it from failing --- code.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/code.js b/code.js index b852e6a..d938075 100644 --- a/code.js +++ b/code.js @@ -112,20 +112,21 @@ function processItem(item, listCounters, images) { prefix = "
  • "; suffix = "
  • "; } - - if (item.isAtDocumentEnd() || item.getNextSibling().getType() != DocumentApp.ElementType.LIST_ITEM) { - if (gt === DocumentApp.GlyphType.BULLET - || gt === DocumentApp.GlyphType.HOLLOW_BULLET - || gt === DocumentApp.GlyphType.SQUARE_BULLET) { - suffix += ""; - } - else { - // Ordered list (
      ): - suffix += "
    "; + + if (item && item.getNextSibling()) { + if (item.isAtDocumentEnd() || item.getNextSibling().getType() != DocumentApp.ElementType.LIST_ITEM) { + if (gt === DocumentApp.GlyphType.BULLET + || gt === DocumentApp.GlyphType.HOLLOW_BULLET + || gt === DocumentApp.GlyphType.SQUARE_BULLET) { + suffix += ""; + } + else { + // Ordered list (
      ): + suffix += "
    "; + } } - } - + counter++; listCounters[key] = counter; }