summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-10-12 12:40:22 +0200
committerGitHub <noreply@github.com>2020-10-12 12:40:22 +0200
commitab0907c1bab2b1f4131aa63d24f9d337692d64a6 (patch)
tree4145b8845f861a8d52e687dce606ab1de9aa96e1
parentd22791c271aceeade16970bffd8e8a3a146de339 (diff)
parent8226cee8d875af8e89cfc79fd94cb430203867b4 (diff)
Merge pull request #42684 from timothyqiu/conn-self-assign
Fix HTTPClient::poll crash after connection is self-assigned
-rw-r--r--core/io/http_client.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 46e45500bf..a25413b21b 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -96,6 +96,10 @@ Error HTTPClient::connect_to_host(const String &p_host, int p_port, bool p_ssl,
void HTTPClient::set_connection(const Ref<StreamPeer> &p_connection) {
ERR_FAIL_COND_MSG(p_connection.is_null(), "Connection is not a reference to a valid StreamPeer object.");
+ if (connection == p_connection) {
+ return;
+ }
+
close();
connection = p_connection;
status = STATUS_CONNECTED;