diff --git a/src/scratchtocatrobat/scratch/scratch3.py b/src/scratchtocatrobat/scratch/scratch3.py index df1cc3ad..8036cf83 100644 --- a/src/scratchtocatrobat/scratch/scratch3.py +++ b/src/scratchtocatrobat/scratch/scratch3.py @@ -170,9 +170,11 @@ def parse_sprite(self, sprite): return scratch2ProjectDict def build_block_structure(self, blockId, temp_block_dict): - block = temp_block_dict[blockId] - if block.nextName is not None: - block.nextBlock = temp_block_dict[block.nextName] - if block.parentName is not None: - block.parentBlock = temp_block_dict[block.parentName] - + try: + block = temp_block_dict[blockId] + if block.nextName is not None: + block.nextBlock = temp_block_dict[block.nextName] + if block.parentName is not None: + block.parentBlock = temp_block_dict[block.parentName] + except KeyError as ex: + log.warn("Block: " + ex.message + " does not exist in the block dictionary.") \ No newline at end of file