Try/Catch “Leak” Error
Hello,
I am testing a try/catch error check if there is no document open, however, after pressing OK on the window to clear the catch error alert, a script error box pops up, when the script should stop. I have tried both with and without using a return; however the error still pops up. Where have I gone wrong?

Here is a snippet of the code in question:
// Open Document Error Check
aDoc();
var originalDoc
function aDoc() {
try {
originalDoc = app.activeDocument
} catch (err) {
alert("An image must be open before running this script!")
}
}
// Save the current ruler units
var savedRuler = app.preferences.rulerUnits;
// File Naming Code
app.preferences.rulerUnits = Units.PIXELS;
var d = app.activeDocument;
Thank you!

