瀏覽代碼

Fix crash when using static methods without return value

Alessandro Famà 3 年之前
父節點
當前提交
d894f48f25
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      include/godot_cpp/core/method_bind.hpp

+ 5 - 1
include/godot_cpp/core/method_bind.hpp

@@ -600,7 +600,11 @@ protected:
 
 	virtual GDNativePropertyInfo gen_argument_type_info(int p_arg) const {
 		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;
 	}
 #if defined(__GNUC__) && !defined(__clang__)