Add check that block associated with comment actually exists.

This commit is contained in:
Karishma Chadha 2018-06-05 15:17:28 -04:00
parent d58bb8bcfb
commit 7c5a2ae8e0

View file

@ -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;
} }