Snap icon indicating copy to clipboard operation
Snap copied to clipboard

"Rename all..." variables error when empty custom LOCAL block present.

Open DarDoro opened this issue 3 years ago • 0 comments

"Rename all..." variables error when empty custom block present.

blocks.js?version=2021-02-27:4039 Uncaught TypeError: Cannot read property 'expression' of null
    at blocks.js?version=2021-02-27:4039
    at Array.forEach (<anonymous>)
    at ReporterBlockMorph.BlockMorph.doRefactorSpriteVar (blocks.js?version=2021-02-27:4038)
    at ReporterBlockMorph.renameVarTo (blocks.js?version=2021-02-27:3904)
    at DialogBoxMorph.accept (widgets.js?version=2021-01-05:2274)
    at DialogBoxMorph.ok (widgets.js?version=2021-01-05:2316)
    at PushButtonMorph.TriggerMorph.trigger (morphic.js?version=2021-02-10:9832)
    at PushButtonMorph.TriggerMorph.mouseClickLeft (morphic.js?version=2021-02-10:9893)
    at PushButtonMorph.mouseClickLeft (widgets.js?version=2021-01-05:210)
    at StringMorph.Morph.escalateEvent (morphic.js?version=2021-02-10:4610)

blocks.js

BlockMorph.prototype.doRefactorSpriteVar = function ( ... receiver.customBlocks.forEach(eachBlock => eachBlock.body.expression.refactorVarInStack(

must be guarded against empty body.

Reported by loucheman @ https://forum.snap.berkeley.edu/t/variable-rename-all/5282

DarDoro avatar Jun 06 '21 16:06 DarDoro