Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -557,6 +557,10 @@ using ScriptableResourceRawPtr = ScriptableResource*; · 556 unmodified lines | ||
| 557 | 557 | |
| 558 | 558 | static QScriptValue scriptableResourceToScriptValue(QScriptEngine* engine, |
| 559 | 559 | const ScriptableResourceRawPtr& resource) { |
| 560 | + if (!resource) { | |
| 561 | + return QScriptValue(); // probably shutting down | |
| 562 | + } | |
| 563 | + | |
| 560 | 564 | // The first script to encounter this resource will track its memory. |
| 561 | 565 | // In this way, it will be more likely to GC. |
| 562 | 566 | // This fails in the case that the resource is used across many scripts, but |