History

avoid shutdown crash

Seth Alves committed 7 years ago

Commit 6ca9ab61 parent ecb34451 file · +4 −0Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+4−0
@@ -557,6 +557,10 @@ using ScriptableResourceRawPtr = ScriptableResource*; · 556 unmodified lines
557557
558558 static QScriptValue scriptableResourceToScriptValue(QScriptEngine* engine,
559559 const ScriptableResourceRawPtr& resource) {
560+ if (!resource) {
561+ return QScriptValue(); // probably shutting down
562+ }
563+
560564 // The first script to encounter this resource will track its memory.
561565 // In this way, it will be more likely to GC.
562566 // This fails in the case that the resource is used across many scripts, but