diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java index 29f72e6ab35..2f33d993b82 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/LanguageMappingStore.java @@ -270,15 +270,17 @@ public class LanguageMappingStore { private void addFileMappings(Map> mappings, ICStorageElement rootElement) { for (Map.Entry> entry : mappings.entrySet()) { - ICStorageElement mapping = rootElement.createChild(FILE_MAPPING); - String path = entry.getKey(); - for (Entry configurationEntry : entry.getValue().entrySet()) { - String configuration = configurationEntry.getKey(); - String language = configurationEntry.getValue(); - - mapping.setAttribute(ATTRIBUTE_PATH, path); - mapping.setAttribute(ATTRIBUTE_CONFIGURATION, configuration); - mapping.setAttribute(ATTRIBUTE_LANGUAGE, language); + if (!entry.getValue().isEmpty()) { + ICStorageElement mapping = rootElement.createChild(FILE_MAPPING); + String path = entry.getKey(); + for (Entry configurationEntry : entry.getValue().entrySet()) { + String configuration = configurationEntry.getKey(); + String language = configurationEntry.getValue(); + + mapping.setAttribute(ATTRIBUTE_PATH, path); + mapping.setAttribute(ATTRIBUTE_CONFIGURATION, configuration); + mapping.setAttribute(ATTRIBUTE_LANGUAGE, language); + } } } }