File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -92,8 +92,10 @@ bool Scratch3Reader::load()
92
92
reporterInfo->setValueId (jsonToValue (blockInfo[2 ]).toString ());
93
93
reporterInfo->setType (static_cast <InputValue::Type>(blockInfo[0 ]));
94
94
95
- block->setX (blockInfo[3 ]);
96
- block->setY (blockInfo[4 ]);
95
+ if (blockInfo.size () > 3 ) {
96
+ block->setX (blockInfo[3 ]);
97
+ block->setY (blockInfo[4 ]);
98
+ }
97
99
98
100
target->addBlock (block);
99
101
continue ;
@@ -118,9 +120,11 @@ bool Scratch3Reader::load()
118
120
119
121
if (block->topLevel ()) {
120
122
READER_STEP (step, " target -> block -> x" );
121
- block->setX (blockInfo[" x" ]);
123
+ if (!blockInfo[" x" ].is_null ())
124
+ block->setX (blockInfo[" x" ]);
122
125
READER_STEP (step, " target -> block -> y" );
123
- block->setY (blockInfo[" y" ]);
126
+ if (!blockInfo[" y" ].is_null ())
127
+ block->setY (blockInfo[" y" ]);
124
128
}
125
129
126
130
// inputs
You can’t perform that action at this time.
0 commit comments