EA-59312, EA-59313 - avoid exception in FormatterImpl.getLineIndent in case of empty document

This commit is contained in:
Dmitry Batrak
2014-08-13 14:48:41 +04:00
parent 26243c1a29
commit fba8e69482
@@ -570,6 +570,7 @@ public class FormatterImpl extends FormatterEx
final TextRange affectedRange) {
final FormattingDocumentModel documentModel = model.getDocumentModel();
final Block block = model.getRootBlock();
if (block.getTextRange().isEmpty()) return null; // handing empty document case
final FormatProcessor processor = buildProcessorAndWrapBlocks(
documentModel, block, settings, indentOptions, new FormatTextRanges(affectedRange, true), offset
);