avoid CCE
authorDmitry Avdeev <dmitry.avdeev@jetbrains.com>
Tue, 9 Feb 2021 10:43:59 +0000 (13:43 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Tue, 9 Feb 2021 10:44:40 +0000 (10:44 +0000)
GitOrigin-RevId: a5f68426601d9b04818447a6b4ce99e336b25ecb

xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java

index ed3bdcc2a3fcb74018d2e6d41ea1e4d8c3429762..b62b36a8395469b5e3a83eba2c2016fc9949bdf5 100644 (file)
@@ -48,13 +48,19 @@ public class XmlCommentImpl extends XmlElementImpl implements XmlComment, XmlEle
 
   @Override
   public XmlTagChild getNextSiblingInTag() {
-    if(getParent() instanceof XmlTag) return (XmlTagChild)getNextSibling();
+    if(getParent() instanceof XmlTag) {
+      PsiElement sibling = getNextSibling();
+      return sibling instanceof XmlTagChild ? (XmlTagChild)sibling : null;
+    }
     return null;
   }
 
   @Override
   public XmlTagChild getPrevSiblingInTag() {
-    if(getParent() instanceof XmlTag) return (XmlTagChild)getPrevSibling();
+    if(getParent() instanceof XmlTag) {
+      PsiElement sibling = getPrevSibling();
+      return sibling instanceof XmlTagChild ? (XmlTagChild)sibling : null;
+    }
     return null;
   }