Skip to content

WebXRManager throws error in onSessionEnd if getController is never called #23983

@kalegd

Description

@kalegd

TLDR: Lack of null check for controllers in onSessionEnd causes errors if getController is never called

It seems controllers are only created when getController or getControllerGrip are called. if those functions are never called, we end up with null controllers in the inputSourcesMap

// Assign controllers to available inputSources
for ( let i = 0; i < inputSources.length; i ++ ) {
const index = inputSources[ i ].handedness === 'right' ? 1 : 0;
inputSourcesMap.set( inputSources[ i ], controllers[ index ] );
}

Once the session ends, there's no null check for the controllers when trying to disconnect them as seen below

function onSessionEnd() {
inputSourcesMap.forEach( function ( controller, inputSource ) {
controller.disconnect( inputSource );
} );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions