Skip to content

Commit bdf9f5c

Browse files
committed
Utils.Array.BringToTop failed to move the penultimate item in an array due to an index error. Fix phaserjs#3658
1 parent 4741ee0 commit bdf9f5c

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ TODO
2828
* The Script File type in the Loader didn't create itself correctly as it was missing an argument (thanks @TadejZupancic)
2929
* The Plugin File type in the Loader didn't create itself correctly as it was missing an argument.
3030
* WebAudioSoundManager.unlock will now check if `document.body` is available before setting the listeners on it. Fixes old versions of Firefox, apparently. #3649 (thanks @squilibob)
31+
* Utils.Array.BringToTop failed to move the penultimate item in an array due to an index error. Fix #3658 (thanks @agar3s)
3132

3233
### Examples, Documentation and TypeScript
3334

src/utils/array/BringToTop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var BringToTop = function (array, item)
2020
{
2121
var currentIndex = array.indexOf(item);
2222

23-
if (currentIndex !== -1 && currentIndex < array.length - 2)
23+
if (currentIndex !== -1 && currentIndex < array.length)
2424
{
2525
array.splice(currentIndex, 1);
2626
array.push(item);

0 commit comments

Comments
 (0)