diff --git a/source/java/writer2latex/xhtml/GreenstoneTags.java b/source/java/writer2latex/xhtml/GreenstoneTags.java
index 7c4b665..0b761af 100644
--- a/source/java/writer2latex/xhtml/GreenstoneTags.java
+++ b/source/java/writer2latex/xhtml/GreenstoneTags.java
@@ -102,6 +102,9 @@ public class GreenstoneTags {
}
private static Node openPageDiv(Node hnode,int pageNum){
+ if (hnode == null){
+ return hnode;
+ }
Document doc = hnode.getOwnerDocument();
Element openBlock = (Element) doc.createElement("div");
openBlock.setAttribute("class", "pageNum");