Skip to content

Commit

Permalink
Check that token is actually present in exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpoole committed Jan 1, 2024
1 parent 6ba5530 commit 1ec70df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .settings/org.eclipse.buildship.core.prefs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import ch.poole.openinghoursparser.RuleModifier;
import ch.poole.openinghoursparser.RuleModifier.Modifier;
import ch.poole.openinghoursparser.TimeSpan;
import ch.poole.openinghoursparser.Token;
import ch.poole.openinghoursparser.TokenMgrError;
import ch.poole.openinghoursparser.VarDate;
import ch.poole.openinghoursparser.VariableTime;
Expand Down Expand Up @@ -841,7 +842,11 @@ private void highlightParseError(@NonNull EditText text, @NonNull OpeningHoursPa
boolean first = true;
int pos = 0;
for (OpeningHoursParseException pex : ohpex.getExceptions()) {
int c = pex.currentToken.next.beginColumn - 1; // starts at 1
Token current = pex.currentToken;
if (current == null || current.next == null ) {
continue;
}
int c = current.next.beginColumn - 1; // starts at 1
spannable.setSpan(new ForegroundColorSpan(Color.RED), c, Math.max(c, Math.min(c + 1, spannable.length())), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if (first) {
pos = c;
Expand Down

0 comments on commit 1ec70df

Please sign in to comment.