From f30e1e3418d1c651178b9990cd9fe40e31415520 Mon Sep 17 00:00:00 2001 From: QinXianSheng <414189369@qq.com> Date: Mon, 22 Jan 2024 18:10:25 +0800 Subject: [PATCH] fix:avoid unexpected value of videoState --- src/extensions/scratch3_video_sensing/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extensions/scratch3_video_sensing/index.js b/src/extensions/scratch3_video_sensing/index.js index 5f8380fe4..dd06b0ec0 100644 --- a/src/extensions/scratch3_video_sensing/index.js +++ b/src/extensions/scratch3_video_sensing/index.js @@ -566,7 +566,7 @@ class Scratch3VideoSensingBlocks { * @param {VideoState} args.VIDEO_STATE - the video state to set the device to */ videoToggle (args) { - const state = args.VIDEO_STATE; + const state = Object.values(VideoState).includes(args.VIDEO_STATE) ? args.VIDEO_STATE : VideoState.OFF; this.globalVideoState = state; if (state === VideoState.OFF) { this.runtime.ioDevices.video.disableVideo();