Do not use lock to get the shared_ptr as it doesn't throw an exception when the std::weak_ptr argument is empty