diff options
author | Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com> | 2021-08-04 06:15:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-04 06:15:25 +0200 |
commit | 2e362d47c81932f0d7596f909e517ef5fcb2fd81 (patch) | |
tree | f7a8e7493f81651a056ec729187613b383ec7a8b | |
parent | d5e13a036f9bfcba8ea1bfb6f4eb603482a74a8f (diff) | |
parent | 6fd2edddc003729755977688790fe9873cbd72f3 (diff) |
Merge pull request #47691 from 31/fix-script_class-null-master
Fix `script_class` null access when reloading a deleted C# script
-rw-r--r-- | modules/mono/csharp_script.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 15a5807370..520262c0eb 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -875,6 +875,13 @@ void CSharpLanguage::reload_assemblies(bool p_soft_reload) { // As scripts are going to be reloaded, must proceed without locking here for (Ref<CSharpScript> &script : scripts) { + // If someone removes a script from a node, deletes the script, builds, adds a script to the + // same node, then builds again, the script might have no path and also no script_class. In + // that case, we can't (and don't need to) reload it. + if (script->get_path().is_empty() && !script->script_class) { + continue; + } + to_reload.push_back(script); if (script->get_path().is_empty()) { |