mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 10:45:37 +02:00
Bug 488264 - NPE in TextEditUtil.flatten
Change-Id: Ie838cc4f7f6f752673eb3254fbf7ade5c907018d
This commit is contained in:
parent
940975d7d7
commit
e6d0eea1b9
1 changed files with 3 additions and 2 deletions
|
@ -90,7 +90,7 @@ public class ChangeFormatter {
|
||||||
|
|
||||||
// Calculate formatting changes for the regions after the refactoring changes.
|
// Calculate formatting changes for the regions after the refactoring changes.
|
||||||
ICProject project = tu.getCProject();
|
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);
|
options.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu);
|
||||||
// Allow all comments to be indented.
|
// Allow all comments to be indented.
|
||||||
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN,
|
options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN,
|
||||||
|
@ -102,6 +102,7 @@ public class ChangeFormatter {
|
||||||
|
|
||||||
TextEdit combinedFormatEdit = new MultiTextEdit();
|
TextEdit combinedFormatEdit = new MultiTextEdit();
|
||||||
for (TextEdit formatEdit : formatEdits) {
|
for (TextEdit formatEdit : formatEdits) {
|
||||||
|
if (formatEdit != null)
|
||||||
combinedFormatEdit = TextEditUtil.merge(combinedFormatEdit, formatEdit);
|
combinedFormatEdit = TextEditUtil.merge(combinedFormatEdit, formatEdit);
|
||||||
}
|
}
|
||||||
formatEdits = TextEditUtil.flatten(combinedFormatEdit).removeChildren();
|
formatEdits = TextEditUtil.flatten(combinedFormatEdit).removeChildren();
|
||||||
|
|
Loading…
Add table
Reference in a new issue