diff options
author | Sergey Prigogin | 2016-02-22 23:41:27 +0000 |
---|---|---|
committer | Sergey Prigogin | 2016-02-22 23:41:27 +0000 |
commit | e6d0eea1b9a3fe64a28437157aee680e090120e1 (patch) | |
tree | 6a8d6df9148755d695b4ed2529f46e2b3258282d | |
parent | 940975d7d7ea59a1e9f7d5e423a37a4f3e9bbf0a (diff) | |
download | org.eclipse.cdt-e6d0eea1b9a3fe64a28437157aee680e090120e1.tar.gz org.eclipse.cdt-e6d0eea1b9a3fe64a28437157aee680e090120e1.tar.xz org.eclipse.cdt-e6d0eea1b9a3fe64a28437157aee680e090120e1.zip |
Bug 488264 - NPE in TextEditUtil.flatten
Change-Id: Ie838cc4f7f6f752673eb3254fbf7ade5c907018d
-rw-r--r-- | core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/ChangeFormatter.java | 5 |
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(); |