Guard the fix code against file system exceptions

R=devoncarew@google.com

Review-Url: https://codereview.chromium.org/2997153002 .
This commit is contained in:
Brian Wilkerson 2017-08-17 10:41:21 -07:00
parent bf7d6530b4
commit 4076ef910f

View file

@ -809,10 +809,15 @@ class FixProcessor {
if (library != null) {
targetUnit = library.definingCompilationUnit;
Source targetSource = targetUnit.source;
offset = targetSource.contents.data.length;
filePath = targetSource.fullName;
prefix = '$eol';
suffix = '$eol';
try {
offset = targetSource.contents.data.length;
filePath = targetSource.fullName;
prefix = '$eol';
suffix = '$eol';
} on FileSystemException {
// If we can't read the file to get the offset, then we can't
// create a fix.
}
break;
}
}