Use compile-time constant for the size of the signal parameters

This commit is contained in:
Fredia Huya-Kouadio 2020-05-27 03:05:51 -07:00
parent e7e736c03b
commit 63286ebba4

View file

@ -114,8 +114,10 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_plugin_GodotPlugin_nativeEmitS
String signal_name = jstring_to_string(j_signal_name, env); String signal_name = jstring_to_string(j_signal_name, env);
int count = env->GetArrayLength(j_signal_params); int count = env->GetArrayLength(j_signal_params);
Variant variant_params[count]; ERR_FAIL_COND_MSG(count > VARIANT_ARG_MAX, "Maximum argument count exceeded!");
const Variant *args[count];
Variant variant_params[VARIANT_ARG_MAX];
const Variant *args[VARIANT_ARG_MAX];
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
jobject j_param = env->GetObjectArrayElement(j_signal_params, i); jobject j_param = env->GetObjectArrayElement(j_signal_params, i);