From cdec5a1cef08e463e7c953d0521735a7a06ac541 Mon Sep 17 00:00:00 2001 From: picklesrus Date: Tue, 8 Jan 2019 15:00:00 -0500 Subject: [PATCH] Allow projects with unknown monitors to load. --- src/serialization/sb2.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 7b6defd1d..5e28e8276 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -256,6 +256,13 @@ const globalBroadcastMsgStateGenerator = (function () { */ const parseMonitorObject = (object, runtime, targets, extensions) => { + // If we can't find the block in the spec map, ignore it. + // This happens for things like Lego Wedo 1.0 monitors. + const mapped = specMap[object.cmd]; + if (!mapped) { + log.warn(`Could not find monitor block with opcode: ${object.cmd}`); + return; + } // In scratch 2.0, there are two monitors that now correspond to extension // blocks (tempo and video motion/direction). In the case of the // video motion/direction block, this reporter is not monitorable in Scratch 3.0.