瀏覽代碼

Fixed a crash initializing Android touch IDs

Sam Lantinga 11 年之前
父節點
當前提交
a503dabe01
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/core/android/SDL_android.c

+ 2 - 2
src/core/android/SDL_android.c

@@ -1200,9 +1200,9 @@ int Android_JNI_GetTouchDeviceIds(int **ids) {
             jint* elements = (*env)->GetIntArrayElements(env, array, NULL);
             if (elements) {
                 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) */
-                    *ids[i] = elements[i];
+                    (*ids)[i] = elements[i];
                 }
                 (*env)->ReleaseIntArrayElements(env, array, elements, JNI_ABORT);
             }