avoid shutdown crash

This commit is contained in:
Seth Alves 2019-01-09 17:15:38 -08:00
parent ecb34450bd
commit 6ca9ab6fba

View file

@ -557,6 +557,10 @@ using ScriptableResourceRawPtr = ScriptableResource*;
static QScriptValue scriptableResourceToScriptValue(QScriptEngine* engine,
const ScriptableResourceRawPtr& resource) {
if (!resource) {
return QScriptValue(); // probably shutting down
}
// The first script to encounter this resource will track its memory.
// In this way, it will be more likely to GC.
// This fails in the case that the resource is used across many scripts, but