mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Delete block does nothing if the block doesnt exist
This commit is contained in:
parent
aa0064948a
commit
c8d5ba1d5e
1 changed files with 6 additions and 1 deletions
|
@ -411,7 +411,8 @@ class Blocks {
|
|||
}
|
||||
|
||||
/**
|
||||
* Block management: delete blocks and their associated scripts.
|
||||
* Block management: delete blocks and their associated scripts. Does nothing if a block
|
||||
* with the given ID does not exist.
|
||||
* @param {!string} blockId Id of block to delete
|
||||
*/
|
||||
deleteBlock (blockId) {
|
||||
|
@ -419,6 +420,10 @@ class Blocks {
|
|||
|
||||
// Get block
|
||||
const block = this._blocks[blockId];
|
||||
if (!block) {
|
||||
// No block with the given ID exists
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete children
|
||||
if (block.next !== null) {
|
||||
|
|
Loading…
Reference in a new issue