mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-25 12:45:32 +00:00
Use std::min() for consistency inside ArraySplice
This commit is contained in:
parent
1822b0a2d6
commit
4bf67b30bc
@ -173,9 +173,7 @@ JSValueRef ArraySplice(JSContextRef ctx, JSObjectRef function, JSObjectRef thisO
|
|||||||
}
|
}
|
||||||
|
|
||||||
long remove = std::max<long>(RJSValidatedValueToNumber(ctx, arguments[1]), 0);
|
long remove = std::max<long>(RJSValidatedValueToNumber(ctx, arguments[1]), 0);
|
||||||
if (index + remove > size) {
|
remove = std::min<long>(remove, size - index);
|
||||||
remove = size - index;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<JSObjectRef> removedObjects(remove);
|
std::vector<JSObjectRef> removedObjects(remove);
|
||||||
for (size_t i = 0; i < remove; i++) {
|
for (size_t i = 0; i < remove; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user