SD Freezes, have to force quit, no crash reporter

First, this is a very simple script that I’ve used in many scripts, but it has a stupid typo.

In the repeat loop it’s supposed to say:
set item x of myText to text items of item x myText

but with a typo it says:
set item x of myText to text items of myText

So in a document with 163 lines of tab delimited text, you might expect a problem.

But Script Debugger instantly freezes. I get the spinning pizza. In the doc it says it’s not responding and Force Quit.

Of course, the solution is not to make dumb typos, but freezing immediately seems odd.

The real issue is after I force quit and relaunched I did not get the SD Crash reporting window. I did get the apple crash reporter (which I saved if that would be helpful)

→ Script Debugger 8.0.3 (8A43)
→ Mac OS 11.6.1 (20G224)

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

--get text from BBEdit
set saveTID to AppleScript's text item delimiters
tell application "BBEdit" to set myText to text of window 1
set myText to paragraphs of myText

set AppleScript's text item delimiters to {tab}

repeat with x from 1 to count of myText
   set item x of myText to text items of myText
   
end repeat
myText


set AppleScript's text item delimiters to saveTID


In this case, probably not. That “freeze” is happening in AppleScript, which doesn’t like that sort of code.

I don’t like it either.

By way of explanation, this bit of code causes exponential memory growth that leads AppleScript to quickly hang and ultimately consume all the memory on your machine. This has come up a few times over the years since it’s such an easy typing error.

1 Like