From 567d20fe5f392c8d58f8c1488a24d72a24a098c6 Mon Sep 17 00:00:00 2001 From: karroffel Date: Sun, 14 Jan 2018 01:01:35 +0100 Subject: [PATCH] [GDNative] fix editor crash with NativeScript --- modules/gdnative/nativescript/nativescript.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index e9e31808355..f45217d0316 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -835,12 +835,14 @@ NativeScriptLanguage::~NativeScriptLanguage() { for (Map >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { - L->get()->terminate(); - NSL->library_classes.clear(); - NSL->library_gdnatives.clear(); - NSL->library_script_users.clear(); + if (L->get().is_valid()) + L->get()->terminate(); } + NSL->library_classes.clear(); + NSL->library_gdnatives.clear(); + NSL->library_script_users.clear(); + #ifndef NO_THREADS memdelete(mutex); #endif