mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-10-05 13:29:50 +02:00
Maybe fix IndexOutOfBoundsException when parsing spoiler syntax.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user