mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-10 21:39:57 -04:00
Add fix for adapter
to deal with empty fields
This commit is contained in:
parent
07354cddbc
commit
7427fe4ff3
1 changed files with 9 additions and 1 deletions
|
@ -100,9 +100,17 @@ function domToBlock (blockDOM, blocks, isTopBlock) {
|
|||
case 'field':
|
||||
// Add the field to this block.
|
||||
var fieldName = xmlChild.attribs.name;
|
||||
var fieldData = '';
|
||||
if (xmlChild.children.length > 0 && xmlChild.children[0].data) {
|
||||
fieldData = xmlChild.children[0].data;
|
||||
} else {
|
||||
// If the child of the field with a data property
|
||||
// doesn't exist, set the data to an empty string.
|
||||
fieldData = '';
|
||||
}
|
||||
block.fields[fieldName] = {
|
||||
name: fieldName,
|
||||
value: xmlChild.children[0].data
|
||||
value: fieldData
|
||||
};
|
||||
break;
|
||||
case 'value':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue