mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
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:
parent
5b62733a36
commit
5843425db9
1 changed files with 2 additions and 1 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue