aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-03-11 21:08:46 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-03-11 21:08:46 +0000
commit1a2d0c397c453ae16cf6ae68aa88755e79e609bc (patch)
tree44c9098bba01c469d80e8e7d9c94881346de5306 /app/src
parent21b1e3f51232e56c1e4e112ec222cf7a924c1ddc (diff)
downloadinfinity-for-reddit-1a2d0c397c453ae16cf6ae68aa88755e79e609bc.tar
infinity-for-reddit-1a2d0c397c453ae16cf6ae68aa88755e79e609bc.tar.gz
infinity-for-reddit-1a2d0c397c453ae16cf6ae68aa88755e79e609bc.tar.bz2
infinity-for-reddit-1a2d0c397c453ae16cf6ae68aa88755e79e609bc.tar.lz
infinity-for-reddit-1a2d0c397c453ae16cf6ae68aa88755e79e609bc.tar.xz
infinity-for-reddit-1a2d0c397c453ae16cf6ae68aa88755e79e609bc.tar.zst
infinity-for-reddit-1a2d0c397c453ae16cf6ae68aa88755e79e609bc.zip
Handle null alignment value in TableCell in RichTextJSONConverter.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java24
2 files changed, 15 insertions, 11 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java
index 9daff3ef..04976d31 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditCommentActivity.java
@@ -236,7 +236,7 @@ public class EditCommentActivity extends BaseActivity implements UploadImageEnab
mOauthRetrofit.create(RedditAPI.class)
.editPostOrComment(APIUtils.getOAuthHeader(mAccessToken), params)
- .enqueue(new Callback<String>() {
+ .enqueue(new Callback<>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {
isSubmitting = false;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java
index 6ff044b5..d8b9cd31 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java
@@ -677,16 +677,20 @@ public class RichTextJSONConverter implements Visitor {
}
nodeJSON.put(CONTENT, cArray);
- switch (((TableCell) customNode).getAlignment()) {
- case LEFT:
- nodeJSON.put(TABLE_CELL_ALIGNMENT, TABLE_CELL_ALIGNMENT_LEFT);
- break;
- case CENTER:
- nodeJSON.put(TABLE_CELL_ALIGNMENT, TABLE_CELL_ALIGNMENT_CENTER);
- break;
- case RIGHT:
- nodeJSON.put(TABLE_CELL_ALIGNMENT, TABLE_CELL_ALIGNMENT_RIGHT);
- break;
+ if (((TableCell) customNode).getAlignment() == null) {
+ nodeJSON.put(TABLE_CELL_ALIGNMENT, TABLE_CELL_ALIGNMENT_LEFT);
+ } else {
+ switch (((TableCell) customNode).getAlignment()) {
+ case CENTER:
+ nodeJSON.put(TABLE_CELL_ALIGNMENT, TABLE_CELL_ALIGNMENT_CENTER);
+ break;
+ case RIGHT:
+ nodeJSON.put(TABLE_CELL_ALIGNMENT, TABLE_CELL_ALIGNMENT_RIGHT);
+ break;
+ default:
+ nodeJSON.put(TABLE_CELL_ALIGNMENT, TABLE_CELL_ALIGNMENT_LEFT);
+ break;
+ }
}
contentArrayStack.peek().put(nodeJSON);