diff --git a/sol/state_view.hpp b/sol/state_view.hpp index caca3a50..f073dff0 100644 --- a/sol/state_view.hpp +++ b/sol/state_view.hpp @@ -94,7 +94,7 @@ namespace sol { template object require_core(const std::string& key, Fx&& action, bool create_global = true) { optional loaded = is_loaded_package(key); - if (loaded) + if (loaded && loaded->valid()) return std::move(*loaded); action(); auto sr = stack::get(L);