Fixed a crash initializing Android touch IDs

main
Sam Lantinga 2013-10-20 23:23:25 -07:00
parent f8c11bb955
commit a503dabe01
1 changed files with 2 additions and 2 deletions

View File

@ -1200,9 +1200,9 @@ int Android_JNI_GetTouchDeviceIds(int **ids) {
jint* elements = (*env)->GetIntArrayElements(env, array, NULL); jint* elements = (*env)->GetIntArrayElements(env, array, NULL);
if (elements) { if (elements) {
int i; int i;
*ids = SDL_malloc(number * sizeof (*ids[0])); *ids = SDL_malloc(number * sizeof (**ids));
for (i = 0; i < number; ++i) { /* not assuming sizeof (jint) == sizeof (int) */ for (i = 0; i < number; ++i) { /* not assuming sizeof (jint) == sizeof (int) */
*ids[i] = elements[i]; (*ids)[i] = elements[i];
} }
(*env)->ReleaseIntArrayElements(env, array, elements, JNI_ABORT); (*env)->ReleaseIntArrayElements(env, array, elements, JNI_ABORT);
} }