mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-29 04:17:12 +01:00
Maybe fix IndexOutOfBoundsException when parsing spoiler syntax.
This commit is contained in:
parent
8cbc24b532
commit
1b2602ac3a
@ -145,6 +145,11 @@ public class FullMarkdownActivity extends BaseActivity {
|
||||
int start = 0;
|
||||
boolean find = false;
|
||||
while (matcher.find(start)) {
|
||||
if (markdownStringBuilder.length() < 4
|
||||
|| matcher.start() < 0
|
||||
|| matcher.end() > markdownStringBuilder.length()) {
|
||||
break;
|
||||
}
|
||||
find = true;
|
||||
markdownStringBuilder.delete(matcher.end() - 2, matcher.end());
|
||||
markdownStringBuilder.delete(matcher.start(), matcher.start() + 2);
|
||||
|
@ -279,6 +279,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
int start = 0;
|
||||
boolean find = false;
|
||||
while (matcher.find(start)) {
|
||||
if (markdownStringBuilder.length() < 4
|
||||
|| matcher.start() < 0
|
||||
|| matcher.end() > markdownStringBuilder.length()) {
|
||||
break;
|
||||
}
|
||||
find = true;
|
||||
markdownStringBuilder.delete(matcher.end() - 2, matcher.end());
|
||||
markdownStringBuilder.delete(matcher.start(), matcher.start() + 2);
|
||||
@ -375,6 +380,11 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
||||
int start = 0;
|
||||
boolean find = false;
|
||||
while (matcher.find(start)) {
|
||||
if (markdownStringBuilder.length() < 4
|
||||
|| matcher.start() < 0
|
||||
|| matcher.end() > markdownStringBuilder.length()) {
|
||||
break;
|
||||
}
|
||||
find = true;
|
||||
markdownStringBuilder.delete(matcher.end() - 2, matcher.end());
|
||||
markdownStringBuilder.delete(matcher.start(), matcher.start() + 2);
|
||||
|
@ -136,6 +136,11 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
||||
int start = 0;
|
||||
boolean find = false;
|
||||
while (matcher.find(start)) {
|
||||
if (markdownStringBuilder.length() < 4
|
||||
|| matcher.start() < 0
|
||||
|| matcher.end() > markdownStringBuilder.length()) {
|
||||
break;
|
||||
}
|
||||
find = true;
|
||||
markdownStringBuilder.delete(matcher.end() - 2, matcher.end());
|
||||
markdownStringBuilder.delete(matcher.start(), matcher.start() + 2);
|
||||
|
@ -121,6 +121,11 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
||||
int start = 0;
|
||||
boolean find = false;
|
||||
while (matcher.find(start)) {
|
||||
if (markdownStringBuilder.length() < 4
|
||||
|| matcher.start() < 0
|
||||
|| matcher.end() > markdownStringBuilder.length()) {
|
||||
break;
|
||||
}
|
||||
find = true;
|
||||
markdownStringBuilder.delete(matcher.end() - 2, matcher.end());
|
||||
markdownStringBuilder.delete(matcher.start(), matcher.start() + 2);
|
||||
|
Loading…
Reference in New Issue
Block a user