1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-12 02:35:37 +02:00

Bug 488264 - NPE in TextEditUtil.flatten

Change-Id: Ie838cc4f7f6f752673eb3254fbf7ade5c907018d
This commit is contained in:
Sergey Prigogin 2016-02-22 15:41:27 -08:00
parent 940975d7d7
commit e6d0eea1b9

View file

@ -90,7 +90,7 @@ public class ChangeFormatter {
// Calculate formatting changes for the regions after the refactoring changes.
ICProject project = tu.getCProject();
Map<String, Object> options = new HashMap<String, Object>(project.getOptions(true));
Map<String, Object> options = new HashMap<>(project.getOptions(true));
options.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu);
// Allow all comments to be indented.
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN,
@ -102,7 +102,8 @@ public class ChangeFormatter {
TextEdit combinedFormatEdit = new MultiTextEdit();
for (TextEdit formatEdit : formatEdits) {
combinedFormatEdit = TextEditUtil.merge(combinedFormatEdit, formatEdit);
if (formatEdit != null)
combinedFormatEdit = TextEditUtil.merge(combinedFormatEdit, formatEdit);
}
formatEdits = TextEditUtil.flatten(combinedFormatEdit).removeChildren();