From f4923ada9741e2f7ee747de482b69260cd4c1b55 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 22 Aug 2012 14:42:35 +0400 Subject: [PATCH] IDEA-90141 ClassCastException when using an xml based template (in a template dir) in a Django project. --- xml/impl/src/com/intellij/xml/index/XmlNamespaceIndex.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xml/impl/src/com/intellij/xml/index/XmlNamespaceIndex.java b/xml/impl/src/com/intellij/xml/index/XmlNamespaceIndex.java index 5a4b2a8bf513..6d681d5d32ff 100644 --- a/xml/impl/src/com/intellij/xml/index/XmlNamespaceIndex.java +++ b/xml/impl/src/com/intellij/xml/index/XmlNamespaceIndex.java @@ -160,7 +160,9 @@ public class XmlNamespaceIndex extends XmlIndex { IndexedRelevantResource resource = guessSchema(namespace, tagName, version, ModuleUtilCore.findModuleForPsiElement(file)); - return resource == null ? null : (XmlFile)file.getManager().findFile(resource.getFile()); + if (resource == null) return null; + PsiFile psiFile = file.getManager().findFile(resource.getFile()); + return psiFile instanceof XmlFile ? (XmlFile)psiFile : null; } @Nullable