This is an automated email from the ASF dual-hosted git repository.

ddekany pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/freemarker-docgen.git

commit c34f3863b31718f2c48d463f7048acd5fcc183e6
Author: ddekany <[email protected]>
AuthorDate: Fri Aug 21 22:33:49 2020 +0200

    NPE fix, give proper error message instead.
---
 .../docgen/core/PrintTextWithDocgenSubstitutionsDirective.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/PrintTextWithDocgenSubstitutionsDirective.java
 
b/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/PrintTextWithDocgenSubstitutionsDirective.java
index 44dc1f3..ecbbe87 100644
--- 
a/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/PrintTextWithDocgenSubstitutionsDirective.java
+++ 
b/freemarker-docgen-core/src/main/java/org/freemarker/docgen/core/PrintTextWithDocgenSubstitutionsDirective.java
@@ -209,8 +209,13 @@ public class PrintTextWithDocgenSubstitutionsDirective 
implements TemplateDirect
                         + " where <symbolicName> is in " + 
transform.getInsertableFiles().keySet() + ".");
             }
             String symbolicName = symbolicNameStep.substring(1);
-            Path symbolicNamePath = 
transform.getInsertableFiles().get(symbolicName)
-                    .toAbsolutePath().normalize();
+            Path symbolicNamePath = 
transform.getInsertableFiles().get(symbolicName);
+            if (symbolicNamePath == null) {
+                throw newErrorInDocgenTag("Symbolic insertable file name "
+                        + StringUtil.jQuote(symbolicName) + " is not amongst 
the defined names: "
+                        + transform.getInsertableFiles().keySet());
+            }
+            symbolicNamePath = symbolicNamePath.toAbsolutePath().normalize();
             Path resolvedFilePath = slashIndex != -1
                     ? symbolicNamePath.resolve(pathArg.substring(slashIndex + 
1))
                     : symbolicNamePath;

Reply via email to