Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1aa2e99 authored by Tobias Kaminsky's avatar Tobias Kaminsky Committed by GitHub
Browse files

Merge pull request #72 from nextcloud/fixJsonParser

ignore (empty) json arrays on subject_rich
parents 3fd5bded 82f17fbb
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ package com.owncloud.android.lib.resources.activities.models;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
@@ -51,11 +52,25 @@ public class RichElementTypeAdapter extends TypeAdapter<RichElement> {
            if (count == 0) {
                richElement.setRichSubject(in.nextString());
            } else {
                in.beginObject();
                JsonToken nextType = in.peek();

                switch (nextType) {
                    case BEGIN_OBJECT:
                        in.beginObject();
                        read(richElement, in);

                        in.endObject();
                        break;

                    case BEGIN_ARRAY:
                        in.beginArray();
                        in.endArray();
                        break;

                    default:
                        // do nothing
                        break;
                }

            }
            count++;
        }