mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Merge pull request #30293 from neikeq/issue-29734
Mono: Fix Array IndexOutOfRangeException not being thrown
This commit is contained in:
commit
e4699aa047
@ -46,7 +46,7 @@ void godot_icall_Array_Dtor(Array *ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MonoObject *godot_icall_Array_At(Array *ptr, int index) {
|
MonoObject *godot_icall_Array_At(Array *ptr, int index) {
|
||||||
if (index < 0 || index > ptr->size()) {
|
if (index < 0 || index >= ptr->size()) {
|
||||||
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ MonoObject *godot_icall_Array_At(Array *ptr, int index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MonoObject *godot_icall_Array_At_Generic(Array *ptr, int index, uint32_t type_encoding, GDMonoClass *type_class) {
|
MonoObject *godot_icall_Array_At_Generic(Array *ptr, int index, uint32_t type_encoding, GDMonoClass *type_class) {
|
||||||
if (index < 0 || index > ptr->size()) {
|
if (index < 0 || index >= ptr->size()) {
|
||||||
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ MonoObject *godot_icall_Array_At_Generic(Array *ptr, int index, uint32_t type_en
|
|||||||
}
|
}
|
||||||
|
|
||||||
void godot_icall_Array_SetAt(Array *ptr, int index, MonoObject *value) {
|
void godot_icall_Array_SetAt(Array *ptr, int index, MonoObject *value) {
|
||||||
if (index < 0 || index > ptr->size()) {
|
if (index < 0 || index >= ptr->size()) {
|
||||||
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ MonoBoolean godot_icall_Array_Remove(Array *ptr, MonoObject *item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void godot_icall_Array_RemoveAt(Array *ptr, int index) {
|
void godot_icall_Array_RemoveAt(Array *ptr, int index) {
|
||||||
if (index < 0 || index > ptr->size()) {
|
if (index < 0 || index >= ptr->size()) {
|
||||||
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
GDMonoUtils::set_pending_exception(mono_get_exception_index_out_of_range());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user