Merge pull request #1902 from picklesrus/unknown-monitors

Allow projects with unknown monitors to load.
This commit is contained in:
Paul Kaplan 2019-01-09 14:50:25 -05:00 committed by GitHub
commit c33d6caa2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -257,6 +257,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.