jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.52k stars 749 forks source link

empty Javascript arrays break Snap! #3420

Open YeesterPlus opened 13 hours ago

ego-lay-atman-bay commented 13 hours ago

Can you show me what you're doing?

YeesterPlus commented 13 hours ago

by themselfs they crash it

ego-lay-atman-bay commented 13 hours ago

Actually, I just tested it out, and yeah, they make snap freeze.

untitled script pic (15)

I have a feeling this has to do with the fact that snap uses a list to represent a "selected" value vs a regular string. untitled script pic (16)

Here's the error I get in the console when trying to display an empty javascript array.

Uncaught TypeError: Cannot read properties of undefined (reading 'toString')
    at display (locale.js?version=2024-11-10:69:39)
    at SyntaxElementMorph.showBubble (blocks.js?version=2024-11-12:2688:13)
    at threads.js?version=2024-11-12:427:39
    at Array.forEach (<anonymous>)
    at ThreadManager.removeTerminatedProcesses (threads.js?version=2024-11-12:387:20)
    at ThreadManager.step (threads.js?version=2024-11-12:380:10)
    at StageMorph.step (objects.js?version=2024-11-10:10260:22)
    at Morph.stepFrame (morphic.js?version=2024-10-09:3326:14)
    at morphic.js?version=2024-10-09:3327:46
    at Array.forEach (<anonymous>)

Also, @YeesterPlus, in the future, pleasr give a lot more information than just "it breaks", show us what you're doing. Sending a screenshot is good.

jmoenig commented 5 hours ago

thanks! fixing...