aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java5
4 files changed, 25 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
index f874244c..5e0ce147 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java
@@ -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);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
index 682f7157..6a4dc4db 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentAndPostRecyclerViewAdapter.java
@@ -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);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
index fad4476f..25f19384 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java
@@ -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);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
index b4d74f96..04ec62f2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/MessageRecyclerViewAdapter.java
@@ -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);