diff --git a/proguard-rules.pro b/proguard-rules.pro index 640276083..61d8981b7 100644 --- a/proguard-rules.pro +++ b/proguard-rules.pro @@ -7,6 +7,7 @@ -keep class com.kyleduo.switchbutton.Configuration +# Needed for proper GSON deserialization -keep class com.google.gson.reflect.TypeToken -keep class * extends com.google.gson.reflect.TypeToken -keep public class * implements java.lang.reflect.Type diff --git a/src/main/java/eu/siacs/conversations/entities/Reaction.java b/src/main/java/eu/siacs/conversations/entities/Reaction.java index 38eb46d4c..54cd93833 100644 --- a/src/main/java/eu/siacs/conversations/entities/Reaction.java +++ b/src/main/java/eu/siacs/conversations/entities/Reaction.java @@ -21,8 +21,6 @@ import com.google.gson.stream.JsonWriter; import eu.siacs.conversations.xmpp.Jid; import java.io.IOException; -import java.lang.reflect.Type; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -76,9 +74,8 @@ public class Reaction { return Collections.emptyList(); } try { - Type type = new TypeToken>() {}.getType(); - return GSON.fromJson(asString, type); - } catch (final JsonSyntaxException e) { + return GSON.fromJson(asString, new TypeToken>() {}.getType()); + } catch (final IllegalArgumentException | JsonSyntaxException e) { return Collections.emptyList(); } }