mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-23 00:17:34 +00:00
fix: use the env->IsSameObject function correctly checking class types
This commit is contained in:
parent
2acb7b5169
commit
6998ae7c88
@ -29,8 +29,7 @@ inline jobject serialize_contact(JNIEnv *env, session::config::contact_info info
|
||||
return returnObj;
|
||||
}
|
||||
|
||||
inline session::config::contact_info
|
||||
deserialize_contact(JNIEnv *env, jobject info, session::config::Contacts *conf) {
|
||||
inline session::config::contact_info deserialize_contact(JNIEnv *env, jobject info, session::config::Contacts *conf) {
|
||||
jclass contactClass = env->FindClass("network/loki/messenger/libsession_util/util/Contact");
|
||||
|
||||
jfieldID getId, getName, getNick, getApproved, getApprovedMe, getBlocked, getUserPic, getPriority, getExpiry, getHidden;
|
||||
|
@ -144,10 +144,11 @@ Java_network_loki_messenger_libsession_1util_UserGroupsConfig_erase__Lnetwork_lo
|
||||
auto conf = ptrToUserGroups(env, thiz);
|
||||
auto communityInfo = env->FindClass("network/loki/messenger/libsession_util/util/GroupInfo$CommunityGroupInfo");
|
||||
auto legacyInfo = env->FindClass("network/loki/messenger/libsession_util/util/GroupInfo$LegacyGroupInfo");
|
||||
if (env->GetObjectClass(group_info) == communityInfo) {
|
||||
auto group_object = env->GetObjectClass(group_info);
|
||||
if (env->IsSameObject(group_object, communityInfo)) {
|
||||
auto deserialized = deserialize_community_info(env, group_info, conf);
|
||||
conf->erase(deserialized);
|
||||
} else if (env->GetObjectClass(group_info) == legacyInfo) {
|
||||
} else if (env->IsSameObject(group_object, legacyInfo)) {
|
||||
auto deserialized = deserialize_legacy_group_info(env, group_info, conf);
|
||||
conf->erase(deserialized);
|
||||
}
|
||||
|
@ -96,9 +96,9 @@ namespace util {
|
||||
|
||||
jclass object_class = env->GetObjectClass(expiry_mode);
|
||||
|
||||
if (object_class == after_read) {
|
||||
if (env->IsSameObject(object_class, after_read)) {
|
||||
return std::pair(session::config::expiration_mode::after_read, env->GetLongField(expiry_mode, duration_seconds));
|
||||
} else if (object_class == after_send) {
|
||||
} else if (env->IsSameObject(object_class, after_send)) {
|
||||
return std::pair(session::config::expiration_mode::after_send, env->GetLongField(expiry_mode, duration_seconds));
|
||||
}
|
||||
return std::pair(session::config::expiration_mode::none, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user