Uncaught TypeError on 'dragend' event

Hi, I have a drag end event in my program, and I get this error when I try to drag something out of the screen:
Uncaught TypeError: Cannot read property ‘renderList’ of undefined

This error happens when the ‘dragend’ event triggers when the pointer is outside of this. I think this could be affecting the flow of the program a little bit, and if someone could tell me how to avoid this could be great.

What is the stack trace? Click the error message to open it.

This is the full error:
Uncaught TypeError: Cannot read property ‘renderList’ of undefined
at InputPlugin.sortGameObjects (phaser.js:187734)
at InputPlugin.processOverOutEvents (phaser.js:186899)
at InputPlugin.update (phaser.js:185813)
at InputManager.updateInputPlugins (phaser.js:93090)
at InputManager.onMouseUp (phaser.js:93320)
at onMouseUpWindow (phaser.js:94514)

That’s very strange. What is some of your input code?

This is my ‘drag’ event:

    this.input.on(EVENTS.DRAG, (pointer, obj, dragX, dragY)=>{
        timeClicked = true;
        if(pointer.y >0 && pointer.y < MAX_HEIGHT) {
            if (dragY>67 && dragY<951) {
                obj.y = dragY;
            }
        }
    });

Is used to move a container only on the Y axis under certain limits.
And this is my ‘dragend’ event:

    this.input.on(EVENTS.DRAG_END, (pointer, obj)=>{
        setTimeout(()=>{
            timeClicked = false;
        },300);
        //Momentum animation
        let dutime = pointer.upTime - pointer.downTime;
        let speed = pointer.upY - pointer.downY;
        if(pointer.upY < 0) {
            dutime = 0;
            speed = 0;
            this.tableCont.body.setVelocityY(0);
            //this.tableCont.y = 68;
            let ContSupTween = this.tweens.add({
                targets: this.tableCont,
                y: 68,
                ease: 'Quad.easeIn',
                duration: 100,
            })
        }
        if(pointer.upY > MAX_HEIGHT) {
            dutime = 0;
            speed = 0;
            this.tableCont.body.setVelocityY(0);
            let ContInfTween1 = this.tweens.add({
                targets: this.tableCont,
                y: 950,
                ease: 'Quad.easeIn',
                duration: 100
            })
        }
        if (Math.abs(speed) > 100) {
            if (Math.abs(speed) < 200) {
                speed = 0;
            }
            obj.body.setVelocityY(speed / (dutime / 1000));
        }
    });

The ‘dragend’ event validates where the pointer is and if is offscreen it just moves the object to a certain position, it also adds a little bit of momentum just to be more visually attractive.
Also, the timeClicked variable is used to differentiate between a drag and a click

I don’t know. Try to make a test case?

This bug has only come up a couple of times and it’s really hard to replicate (last time I just randomly clicked and dragged the scene).

zone.js:1777 Uncaught TypeError: Cannot read properties of undefined (reading 'renderList')
    at initialize.sortGameObjects (phaser.js:187734:35)
    at initialize.processOverOutEvents (phaser.js:186899:18)
    at initialize.update (phaser.js:185813:35)
    at initialize.updateInputPlugins (phaser.js:93090:47)
    at initialize.onMouseUp (phaser.js:93320:14)
    at onMouseUpWindow (phaser.js:94514:25)
    at rn.___hb (browser.ts:175:25)
    at q.invokeTask (zone.js:443:35)
    at q.runTask (zone.js:214:51)
    at q.invokeTask [as invoke] (zone.js:525:38)
    sortGameObjects: function (gameObjects, pointer)
    {
        if (gameObjects.length < 2)
        {
            return gameObjects;
        }

        var list = pointer.camera.renderList; // <--- Here

        return gameObjects.sort(function (childA, childB)
        {
            return list.indexOf(childB) - list.indexOf(childA);
        });
    },