Skip to content

Commit 77c9774

Browse files
committed
check for nullptr to avoid a possible crash
1 parent 177341e commit 77c9774

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

jni-c-toxcore/jni-c-toxcore.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4777,6 +4777,11 @@ Java_com_zoffcc_applications_trifa_MainActivity_tox_1self_1set_1nospam(JNIEnv *e
47774777
JNIEXPORT jlong JNICALL
47784778
Java_com_zoffcc_applications_trifa_MainActivity_tox_1self_1get_1nospam(JNIEnv *env, jobject thiz)
47794779
{
4780+
if(tox_global == NULL)
4781+
{
4782+
return -1;
4783+
}
4784+
47804785
uint32_t nospam = tox_self_get_nospam(tox_global);
47814786
return (jlong)nospam;
47824787
}

0 commit comments

Comments
 (0)