diff --git a/src/js_sync.hpp b/src/js_sync.hpp index 8a57aaa6..238ab94c 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -390,9 +390,10 @@ void SessionClass::get_config(ContextType ctx, ObjectType object, ReturnValue ObjectType config = Object::create_empty(ctx); Object::set_property(ctx, config, "user", create_object>(ctx, new SharedUser(session->config().user))); Object::set_property(ctx, config, "url", Value::from_string(ctx, session->config().realm_url())); - if (auto* dispatcher = session->config().error_handler.template target>()) { - auto& handler = *dispatcher->func().template target>(); - Object::set_property(ctx, config, "error", handler.func()); + if (auto dispatcher = session->config().error_handler.template target>()) { + if (auto handler = dispatcher->func().template target>()) { + Object::set_property(ctx, config, "error", handler->func()); + } } return_value.set(config); } else {