diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-10-10 10:10:30 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2020-10-10 10:10:30 +0800 |
commit | 8226cee8d875af8e89cfc79fd94cb430203867b4 (patch) | |
tree | 0c77bb9b583790d904330226d0e2467c539f0b08 | |
parent | 7c4d1e9c650f40de99f959e90795bd8443b7fd3d (diff) |
Fixes HTTPClient::poll crash after connection is self-assigned
-rw-r--r-- | core/io/http_client.cpp | 4 |
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; |