summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/language_server/gdscript_language_protocol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript/language_server/gdscript_language_protocol.cpp')
-rw-r--r--modules/gdscript/language_server/gdscript_language_protocol.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/modules/gdscript/language_server/gdscript_language_protocol.cpp b/modules/gdscript/language_server/gdscript_language_protocol.cpp
index 112db4df3a..8489fc08c1 100644
--- a/modules/gdscript/language_server/gdscript_language_protocol.cpp
+++ b/modules/gdscript/language_server/gdscript_language_protocol.cpp
@@ -278,6 +278,11 @@ void GDScriptLanguageProtocol::stop() {
}
void GDScriptLanguageProtocol::notify_client(const String &p_method, const Variant &p_params, int p_client_id) {
+#ifdef TESTS_ENABLED
+ if (clients.is_empty()) {
+ return;
+ }
+#endif
if (p_client_id == -1) {
ERR_FAIL_COND_MSG(latest_client_id == -1,
"GDScript LSP: Can't notify client as none was connected.");
@@ -285,7 +290,7 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia
}
ERR_FAIL_COND(!clients.has(p_client_id));
Ref<LSPeer> peer = clients.get(p_client_id);
- ERR_FAIL_COND(peer == nullptr);
+ ERR_FAIL_NULL(peer);
Dictionary message = make_notification(p_method, p_params);
String msg = Variant(message).to_json_string();
@@ -294,6 +299,11 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia
}
void GDScriptLanguageProtocol::request_client(const String &p_method, const Variant &p_params, int p_client_id) {
+#ifdef TESTS_ENABLED
+ if (clients.is_empty()) {
+ return;
+ }
+#endif
if (p_client_id == -1) {
ERR_FAIL_COND_MSG(latest_client_id == -1,
"GDScript LSP: Can't notify client as none was connected.");
@@ -301,7 +311,7 @@ void GDScriptLanguageProtocol::request_client(const String &p_method, const Vari
}
ERR_FAIL_COND(!clients.has(p_client_id));
Ref<LSPeer> peer = clients.get(p_client_id);
- ERR_FAIL_COND(peer == nullptr);
+ ERR_FAIL_NULL(peer);
Dictionary message = make_request(p_method, p_params, next_server_id);
next_server_id++;