Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1773)

Unified Diff: pkg/analyzer/bin/formatter.dart

Issue 152863006: pkg/analyzer: fix formatter bin crash due to empty selection flag (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/bin/formatter.dart
diff --git a/pkg/analyzer/bin/formatter.dart b/pkg/analyzer/bin/formatter.dart
index 0466f40df5042446743cfcedab6981d78ed04335..400b309eff144d4f5e4a8aa19225ebe1e7fb9102 100755
--- a/pkg/analyzer/bin/formatter.dart
+++ b/pkg/analyzer/bin/formatter.dart
@@ -90,15 +90,15 @@ int _parseLineLength(String lengthOption) {
}
-Selection _parseSelection(selectionOption) {
- if (selectionOption != null) {
- var units = selectionOption.split(',');
- if (units.length == 2) {
- var offset = _toInt(units[0]);
- var length = _toInt(units[1]);
- if (offset != null && length != null) {
- return new Selection(offset, length);
- }
+Selection _parseSelection(String selectionOption) {
+ if(selectionOption == null) return null;
+
+ var units = selectionOption.split(',');
+ if (units.length == 2) {
+ var offset = _toInt(units[0]);
+ var length = _toInt(units[1]);
+ if (offset != null && length != null) {
+ return new Selection(offset, length);
}
}
throw new FormatterException('Selections are specified as integer pairs '
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698