Skip to content

shareSoundToTarget should be resilient to non-existent targets #1932

@picklesrus

Description

@picklesrus

Expected Behavior

shareSoundToTarget shouldn't crash when you call it with a null target. It already checks whether target exists before adding the sound, but not before accessing other properties on the target (i.e. sprite) See the following line of code:
https://github.com/LLK/scratch-vm/blob/develop/src/virtual-machine.js#L1240

Noticed this when trying to debug reordering of sounds crash fixed in the PR below. We shouldn't have been calling into this code, but we could be more resilient (as the costumes are) scratchfoundation/scratch-gui#4389

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions