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()
9292 reporterInfo->setValueId (jsonToValue (blockInfo[2 ]).toString ());
9393 reporterInfo->setType (static_cast <InputValue::Type>(blockInfo[0 ]));
9494
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+ }
9799
98100 target->addBlock (block);
99101 continue ;
@@ -118,9 +120,11 @@ bool Scratch3Reader::load()
118120
119121 if (block->topLevel ()) {
120122 READER_STEP (step, " target -> block -> x" );
121- block->setX (blockInfo[" x" ]);
123+ if (!blockInfo[" x" ].is_null ())
124+ block->setX (blockInfo[" x" ]);
122125 READER_STEP (step, " target -> block -> y" );
123- block->setY (blockInfo[" y" ]);
126+ if (!blockInfo[" y" ].is_null ())
127+ block->setY (blockInfo[" y" ]);
124128 }
125129
126130 // inputs
You can’t perform that action at this time.
0 commit comments