diff --git a/src/com/google/javascript/jscomp/LightweightMessageFormatter.java b/src/com/google/javascript/jscomp/LightweightMessageFormatter.java
index f529b7d0624..420dbc07d70 100644
--- a/src/com/google/javascript/jscomp/LightweightMessageFormatter.java
+++ b/src/com/google/javascript/jscomp/LightweightMessageFormatter.java
@@ -92,8 +92,10 @@ private String format(JSError error, boolean warning) {
int charno = error.getCharno();
// padding equal to the excerpt and arrow at the end
+ // charno == sourceExpert.length() means something is missing
+ // at the end of the line
if (excerpt.equals(LINE)
- && 0 <= charno && charno < sourceExcerpt.length()) {
+ && 0 <= charno && charno <= sourceExcerpt.length()) {
for (int i = 0; i < charno; i++) {
char c = sourceExcerpt.charAt(i);
if (Character.isWhitespace(c)) {