make sure ChunkExtractor won't be called for binary files

This commit is contained in:
Alexey Kudravtsev
2015-12-02 15:29:14 +03:00
parent f82787cd53
commit 3a89b61d9d
2 changed files with 3 additions and 3 deletions
@@ -116,6 +116,7 @@ public class ChunkExtractor {
Project project = file.getProject();
myDocument = PsiDocumentManager.getInstance(project).getDocument(file);
LOG.assertTrue(myDocument != null);
final FileType fileType = file.getFileType();
SyntaxHighlighter highlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, project, file.getVirtualFile());
highlighter = highlighter == null ? new PlainSyntaxHighlighter() : highlighter;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -520,13 +520,12 @@ public class UsageInfo2UsageAdapter implements UsageInModule,
PsiFile file = getPsiFile();
if (file != null) {
ChunkExtractor extractor = ChunkExtractor.getExtractor(file);
Segment segment = getFirstSegment();
if (segment != null) {
Document document = PsiDocumentManager.getInstance(getProject()).getDocument(file);
if (document != null) {
ChunkExtractor extractor = ChunkExtractor.getExtractor(file);
SmartList<TextChunk> chunks = new SmartList<TextChunk>();
extractor.createTextChunks(
this,