diff --git a/platform/platform-api/src/com/intellij/lang/PerFileMappingsBase.java b/platform/platform-api/src/com/intellij/lang/PerFileMappingsBase.java index 6e267e252e19..49c7f24bfe6a 100644 --- a/platform/platform-api/src/com/intellij/lang/PerFileMappingsBase.java +++ b/platform/platform-api/src/com/intellij/lang/PerFileMappingsBase.java @@ -214,14 +214,13 @@ public abstract class PerFileMappingsBase implements PersistentStateComponent return o1.getPath().compareTo(o2.getPath()); }); for (VirtualFile file : files) { - final T dialect = myMappings.get(file); - String value = serialize(dialect); - if (value != null) { - final Element child = new Element("file"); - element.addContent(child); - child.setAttribute("url", file == null ? "PROJECT" : file.getUrl()); - child.setAttribute(getValueAttribute(), value); - } + T dialect = myMappings.get(file); + String value = dialect == null ? null : serialize(dialect); + if (value == null) continue; + Element child = new Element("file"); + element.addContent(child); + child.setAttribute("url", file == null ? "PROJECT" : file.getUrl()); + child.setAttribute(getValueAttribute(), value); } return element; }