Skip to content

Commit

Permalink
Fix NPE when language entry is incomplete (as it is for LLVM)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgraham committed Aug 11, 2023
1 parent dd4a40a commit 72c8186
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/org.eclipse.cdt.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.ui; singleton:=true
Bundle-Version: 8.1.0.qualifier
Bundle-Version: 8.1.100.qualifier
Bundle-Activator: org.eclipse.cdt.ui.CUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.Set;
import java.util.TreeMap;

import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.LanguageManager;
import org.eclipse.cdt.internal.ui.preferences.PreferencesMessages;
import org.eclipse.cdt.internal.ui.util.Messages;
Expand Down Expand Up @@ -161,7 +162,12 @@ public void refreshMappings() {

String contentType = entry.getKey();
String contentTypeName = contentTypeManager.getContentType(contentType).getName();
String languageName = LanguageManager.getInstance().getLanguage(entry.getValue()).getName();
String languageKey = entry.getValue();
String languageName = languageKey;
ILanguage language = LanguageManager.getInstance().getLanguage(languageKey);
if (language != null) {
languageName = language.getName();
}

if (fOverriddenContentTypes.contains(contentType)) {
item.setText(0, Messages.format(PreferencesMessages.ProjectLanguagesPropertyPage_overriddenContentType,
Expand Down

0 comments on commit 72c8186

Please sign in to comment.