Jelajahi Sumber

Fix HTTPClient::poll crash when connection set to null

Artem Burjachenko 6 tahun lalu
induk
melakukan
b73073ae36
1 mengubah file dengan 2 tambahan dan 0 penghapusan
  1. 2 0
      core/io/http_client.cpp

+ 2 - 0
core/io/http_client.cpp

@@ -98,6 +98,8 @@ 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.");
+
 	close();
 	connection = p_connection;
 	status = STATUS_CONNECTED;