diff --git a/src/main/java/w2phtml/xhtml/content/TextParser.java b/src/main/java/w2phtml/xhtml/content/TextParser.java
index 07d1cac..d18236d 100644
--- a/src/main/java/w2phtml/xhtml/content/TextParser.java
+++ b/src/main/java/w2phtml/xhtml/content/TextParser.java
@@ -1164,7 +1164,7 @@ public class TextParser extends Parser {
getTextSP().readStyle(sStyleName,info);
getTextSP().readParentStyle(sStyleName,info);
Element newNode = node;
- if (info.hasAttributes() || !"span".equals(info.sTagName)) {
+ if (info.hasAttributes() || info.sTagName != null && !"span".equals(info.sTagName)) {
// We (probably) need to create a new element
newNode = converter.createElement(info.sTagName);
writeStyle(info,newNode);