Fix scripts being loaded on start even if they don't exist

Application::loadScript should not store a reference to a script until
it has been successfully loaded.  Previously if a script didn't exist it
would be "loaded" and show up in the running scripts window, but
wouldn't have been successfully loaded, and wouldn't be running anything
at all.
This commit is contained in:
Ryan Huffman 2014-06-17 09:18:58 -07:00
parent 5b62733a36
commit 5843425db9

View file

@ -3523,12 +3523,13 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript
} else {
// start the script on a new thread...
scriptEngine = new ScriptEngine(scriptUrl, &_controllerScriptingInterface);
_scriptEnginesHash.insert(scriptURLString, scriptEngine);
if (!scriptEngine->hasScript()) {
qDebug() << "Application::loadScript(), script failed to load...";
return NULL;
}
_scriptEnginesHash.insert(scriptURLString, scriptEngine);
_runningScriptsWidget->setRunningScripts(getRunningScripts());
}