mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
Cleanup of raw nullptr
checks with Ref
Using `is_valid/null` over checks with `nullptr` or `ERR_FAIL_NULL` etc.
This commit is contained in:
parent
61598c5c88
commit
194bdde947
48 changed files with 169 additions and 170 deletions
|
@ -196,7 +196,7 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
|
|||
ERR_FAIL_COND_V_MSG(!clients.has(latest_client_id), ret.to_json(),
|
||||
vformat("GDScriptLanguageProtocol: Can't initialize invalid peer '%d'.", latest_client_id));
|
||||
Ref<LSPeer> peer = clients.get(latest_client_id);
|
||||
if (peer != nullptr) {
|
||||
if (peer.is_valid()) {
|
||||
String msg = Variant(request).to_json_string();
|
||||
msg = format_output(msg);
|
||||
(*peer)->res_queue.push_back(msg.utf8());
|
||||
|
@ -298,7 +298,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_NULL(peer);
|
||||
ERR_FAIL_COND(peer.is_null());
|
||||
|
||||
Dictionary message = make_notification(p_method, p_params);
|
||||
String msg = Variant(message).to_json_string();
|
||||
|
@ -319,7 +319,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_NULL(peer);
|
||||
ERR_FAIL_COND(peer.is_null());
|
||||
|
||||
Dictionary message = make_request(p_method, p_params, next_server_id);
|
||||
next_server_id++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue