Merge pull request #778 from alessandrofama/4.x_fix_static_no_return

Fix crash when using static methods without return value due to uninitialized GDNativePropertyInfo struct members
pull/660/head
Fabio Alessandrelli 2022-07-03 21:11:35 +02:00 committed by GitHub
commit 794dea0dd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -600,7 +600,11 @@ protected:
virtual GDNativePropertyInfo gen_argument_type_info(int p_arg) const { virtual GDNativePropertyInfo gen_argument_type_info(int p_arg) const {
GDNativePropertyInfo pi; GDNativePropertyInfo pi;
call_get_argument_type_info<P...>(p_arg, pi); if (p_arg >= 0 && p_arg < (int)sizeof...(P)) {
call_get_argument_type_info<P...>(p_arg, pi);
} else {
pi = PropertyInfo();
}
return pi; return pi;
} }
#if defined(__GNUC__) && !defined(__clang__) #if defined(__GNUC__) && !defined(__clang__)