Browse Source

Fixes HTTPClient::poll crash after connection is self-assigned

(cherry picked from commit 8226cee8d875af8e89cfc79fd94cb430203867b4)
Haoyu Qiu 4 years ago
parent
commit
9119560d4d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      core/io/http_client.cpp

+ 4 - 0
core/io/http_client.cpp

@@ -100,6 +100,10 @@ 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;