summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-10-05 09:15:05 +0200
committerGitHub <noreply@github.com>2018-10-05 09:15:05 +0200
commitfc6cf69a900aa9ce7d29e94fa2cba1ff5c1b659f (patch)
tree5e93ef0adf4a85bada8aa3ef12b78acac90c5773
parent0173cf640253af2f1a5c2dd583952e83c2a60ced (diff)
parent6415454581c3ba0025da6b9bae42e060fa4e1508 (diff)
downloadredot-engine-fc6cf69a900aa9ce7d29e94fa2cba1ff5c1b659f.tar.gz
Merge pull request #22737 from DualMatrix/warn_sort_custom
Added a check in sort_custom that test whether the given method exists.
-rw-r--r--core/array.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/array.cpp b/core/array.cpp
index 9708452850..9f09ddbe15 100644
--- a/core/array.cpp
+++ b/core/array.cpp
@@ -258,6 +258,7 @@ struct _ArrayVariantSortCustom {
Array &Array::sort_custom(Object *p_obj, const StringName &p_function) {
ERR_FAIL_NULL_V(p_obj, *this);
+ ERR_FAIL_COND_V(!p_obj->has_method(p_function), *this);
SortArray<Variant, _ArrayVariantSortCustom, true> avs;
avs.compare.obj = p_obj;