Closed cnsilvan closed 6 years ago
private void addLinkToSpan(Spannable s, Link link) {
// maybe this line
Pattern pattern = Pattern.compile(Pattern.quote(link.getText()));
// maybe this line
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
int start = matcher.start();
if (start >= 0) {
int end = start + link.getText().length();
applyLink(link, new Range(start, end), s);
}
if (findOnlyFirstMatch) {
break;
}
}
}
For this, it would be very helpful if you could provide an example that will throw the exception.
Closing for no followup or method to reproduce it
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.indexOf(java.lang.String, int)' on a null object reference at java.util.regex.Pattern.quote(Pattern.java:439) at com.klinker.android.link_builder.LinkBuilder.on(Unknown Source) setText setContext addLinks build addLinkToSpan addLinkToSpan applyLink