mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Add check that block associated with comment actually exists.
This commit is contained in:
parent
d58bb8bcfb
commit
7c5a2ae8e0
1 changed files with 7 additions and 1 deletions
|
@ -209,7 +209,13 @@ class Target extends EventEmitter {
|
||||||
width, height, minimized);
|
width, height, minimized);
|
||||||
if (blockId) {
|
if (blockId) {
|
||||||
newComment.blockId = blockId;
|
newComment.blockId = blockId;
|
||||||
this.blocks.getBlock(blockId).comment = id;
|
const blockWithComment = this.blocks.getBlock(blockId);
|
||||||
|
if (blockWithComment) {
|
||||||
|
blockWithComment.comment = id;
|
||||||
|
} else {
|
||||||
|
log.warn(`Could not find block with id ${blockId
|
||||||
|
} associated with commentId: ${id}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.comments[id] = newComment;
|
this.comments[id] = newComment;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue