diff --git a/android/app/src/main/java/chat/rocket/reactnative/Ejson.java b/android/app/src/main/java/chat/rocket/reactnative/Ejson.java index 233d5f15b..baf263260 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/Ejson.java +++ b/android/app/src/main/java/chat/rocket/reactnative/Ejson.java @@ -67,15 +67,17 @@ public class Ejson { } public String token() { - if (mmkv != null) { - return mmkv.decodeString(TOKEN_KEY.concat(userId())); + String userId = userId(); + if (mmkv != null && userId != null) { + return mmkv.decodeString(TOKEN_KEY.concat(userId)); } return ""; } public String userId() { - if (mmkv != null) { - return mmkv.decodeString(TOKEN_KEY.concat(serverURL())); + String serverURL = serverURL(); + if (mmkv != null && serverURL != null) { + return mmkv.decodeString(TOKEN_KEY.concat(serverURL)); } return ""; }