mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 06:23:37 -05:00
Fix up list monitor names during deserialization
This commit is contained in:
parent
8faad67439
commit
48088f40f8
1 changed files with 14 additions and 0 deletions
|
@ -1098,6 +1098,20 @@ const deserializeMonitor = function (monitorData, runtime, targets, extensions)
|
|||
// This will be undefined for extension blocks
|
||||
const monitorBlockInfo = runtime.monitorBlockInfo[monitorData.opcode];
|
||||
|
||||
// Due to a bug (see https://github.com/LLK/scratch-vm/pull/2322), renamed list monitors may have been serialized
|
||||
// with an outdated/incorrect LIST parameter. Fix it up to use the current name of the actual corresponding list.
|
||||
if (monitorData.opcode === 'data_listcontents') {
|
||||
const listTarget = monitorData.targetId ?
|
||||
targets.find(t => t.id === monitorData.targetId) :
|
||||
targets.find(t => t.isStage);
|
||||
if (
|
||||
listTarget &&
|
||||
Object.prototype.hasOwnProperty.call(listTarget.variables, monitorData.id)
|
||||
) {
|
||||
monitorData.params.LIST = listTarget.variables[monitorData.id].name;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert the serialized monitorData params into the block fields structure
|
||||
const fields = {};
|
||||
for (const paramKey in monitorData.params) {
|
||||
|
|
Loading…
Reference in a new issue