Delete block does nothing if the block doesnt exist

This commit is contained in:
DD 2017-11-15 11:55:22 -05:00
parent aa0064948a
commit c8d5ba1d5e

View file

@ -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) {