diagnostics
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Fri, 20 Jan 2012 08:15:20 +0000 (12:15 +0400)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Fri, 20 Jan 2012 10:36:11 +0000 (14:36 +0400)
xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java

index cfc9864940d8f13ecb265a112889f78a41467cdc..cdf1f1b58dc0710f3af7d55e141210224e206a3a 100644 (file)
@@ -498,8 +498,9 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag {
           (XmlTagImpl)XmlElementFactory.getInstance(getProject()).createTagFromText(XmlTagUtil.composeTagText(name, "aa"));
         final XmlTagImpl tag = XmlTagImpl.this;
         final CharTable charTableByTree = SharedImplUtil.findCharTableByTree(tag);
-        tag.replaceChild(XmlChildRole.START_TAG_NAME_FINDER.findChild(tag),
-                         ChangeUtil.copyElement((TreeElement)XmlChildRole.START_TAG_NAME_FINDER.findChild(dummyTag), charTableByTree));
+        ASTNode child = XmlChildRole.START_TAG_NAME_FINDER.findChild(tag);
+        LOG.assertTrue(child != null, "It seems '" + name + "' is not a valid tag name");
+        tag.replaceChild(child, ChangeUtil.copyElement((TreeElement)XmlChildRole.START_TAG_NAME_FINDER.findChild(dummyTag), charTableByTree));
         final ASTNode childByRole = XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(tag);
         if (childByRole != null) {
           final TreeElement treeElement = (TreeElement)XmlChildRole.CLOSING_TAG_NAME_FINDER.findChild(dummyTag);