summaryrefslogtreecommitdiff
path: root/src/3rdparty/squirrel
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/squirrel')
-rw-r--r--src/3rdparty/squirrel/squirrel/sqbaselib.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
index 8d2126950..486b888b5 100644
--- a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp
@@ -538,6 +538,10 @@ bool _hsort_sift_down(HSQUIRRELVM v,SQArray *arr, SQInteger root, SQInteger bott
if(!_sort_compare(v,arr->_values[root],arr->_values[maxChild],func,ret))
return false;
if (ret < 0) {
+ if (root == maxChild) {
+ v->Raise_Error(_SC("inconsistent compare function"));
+ return false; // We'd be swapping ourselve. The compare function is incorrect
+ }
_Swap(arr->_values[root],arr->_values[maxChild]);
root = maxChild;
}