FileTypeManagerImpl return null if file type is not found by name

GitOrigin-RevId: b51e76fa0245de79c0c10dfea807d8b66991f3c4
This commit is contained in:
Dmitro Batko
2019-12-31 13:06:25 +00:00
committed by intellij-monorepo-bot
parent 50ff05d624
commit d153a0e89a
@@ -933,14 +933,15 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements Persistent
FileType type = getStdFileType(fileTypeName);
// TODO: Abstract file types are not std one, so need to be restored specially,
// currently there are 6 of them and restoration does not happen very often so just iteration is enough
if (type == PlainTextFileType.INSTANCE && !fileTypeName.equals(type.getName())) {
for (FileType fileType: mySchemeManager.getAllSchemes()) {
if (fileTypeName.equals(fileType.getName())) {
return fileType;
}
if (type != PlainTextFileType.INSTANCE || fileTypeName.equals(type.getName())) {
return type;
}
for (FileType fileType: mySchemeManager.getAllSchemes()) {
if (fileTypeName.equals(fileType.getName())) {
return fileType;
}
}
return type;
return null;
}
private static boolean isDetectable(@NotNull final VirtualFile file) {