Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2016-02-22 23:41:27 +0000
committerSergey Prigogin2016-02-22 23:41:27 +0000
commite6d0eea1b9a3fe64a28437157aee680e090120e1 (patch)
tree6a8d6df9148755d695b4ed2529f46e2b3258282d
parent940975d7d7ea59a1e9f7d5e423a37a4f3e9bbf0a (diff)
downloadorg.eclipse.cdt-e6d0eea1b9a3fe64a28437157aee680e090120e1.tar.gz
org.eclipse.cdt-e6d0eea1b9a3fe64a28437157aee680e090120e1.tar.xz
org.eclipse.cdt-e6d0eea1b9a3fe64a28437157aee680e090120e1.zip
Bug 488264 - NPE in TextEditUtil.flatten
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/ChangeFormatter.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/ChangeFormatter.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/ChangeFormatter.java
index 145a7da4601..6fc4cfc5d24 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/ChangeFormatter.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/ChangeFormatter.java
@@ -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();

Back to the top