Guard against no script engine thread affinity

This commit is contained in:
Zach Pomerantz 2016-04-06 14:40:55 -07:00
parent 1e710712cc
commit 06e827cb5e

View file

@ -154,8 +154,10 @@ ScriptEngine::~ScriptEngine() {
void ScriptEngine::disconnectNonEssentialSignals() {
disconnect();
if (_isRunning && _isThreaded) { // ensure the thread is running
connect(this, &ScriptEngine::doneRunning, thread(), &QThread::quit);
QThread* receiver;
// Ensure the thread should be running, and does exist
if (_isRunning && _isThreaded && (receiver = thread())) {
connect(this, &ScriptEngine::doneRunning, receiver, &QThread::quit);
}
}