diff --git a/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java b/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java
index <HASH>..<HASH> 100644
--- a/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java
+++ b/structr-ui/src/main/java/org/structr/web/entity/dom/DOMNode.java
@@ -959,9 +959,11 @@ public interface DOMNode extends NodeInterface, Node, Renderable, DOMAdoptable, 
 	}
 
 	static boolean checkOwnerDocumentIsShadowPage(DOMNode ownerDocument) {
+		
 		boolean isShadowPage = false;
+		
 		try {
-			isShadowPage = ownerDocument.equals(CreateComponentCommand.getOrCreateHiddenDocument());
+			isShadowPage = ownerDocument != null && ownerDocument.equals(CreateComponentCommand.getOrCreateHiddenDocument());
 		} catch (FrameworkException fex) {
 			logger.warn("Unable fetch ShadowDocument node: {}", fex.getMessage());
 		}
Bug fix: Avoid NPE in public mode if shadow page is not visible to public users (which is the default).