Skip to content

Commit 0fe27ba

Browse files
Philipp FleischhackerAntiDog
Philipp Fleischhacker
authored andcommitted
[STCC-189] skip blocks that have neither a parent nor a next block (#120)
1 parent 4807635 commit 0fe27ba

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/scratchtocatrobat/scratch/scratch3.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ def parse_sprite(self, sprite):
170170
return scratch2ProjectDict
171171

172172
def build_block_structure(self, blockId, temp_block_dict):
173-
block = temp_block_dict[blockId]
174-
if block.nextName is not None:
175-
block.nextBlock = temp_block_dict[block.nextName]
176-
if block.parentName is not None:
177-
block.parentBlock = temp_block_dict[block.parentName]
178-
173+
try:
174+
block = temp_block_dict[blockId]
175+
if block.nextName is not None:
176+
block.nextBlock = temp_block_dict[block.nextName]
177+
if block.parentName is not None:
178+
block.parentBlock = temp_block_dict[block.parentName]
179+
except KeyError as ex:
180+
log.warn("Block: " + ex.message + " does not exist in the block dictionary.")

0 commit comments

Comments
 (0)