@@ -44,8 +44,10 @@ bool RemoteDebuggerPeerTCP::has_message() {
4444
4545Array RemoteDebuggerPeerTCP::get_message () {
4646 MutexLock lock (mutex);
47- ERR_FAIL_COND_V (!has_message (), Array ());
48- Array out = in_queue.front ()->get ();
47+ List<Array>::Element *E = in_queue.front ();
48+ ERR_FAIL_NULL_V_MSG (E, Array (), " No remote debugger messages in queue." );
49+
50+ Array out = E->get ();
4951 in_queue.pop_front ();
5052 return out;
5153}
@@ -96,11 +98,13 @@ void RemoteDebuggerPeerTCP::_write_out() {
9698 while (tcp_client->get_status () == StreamPeerTCP::STATUS_CONNECTED && tcp_client->wait (NetSocket::POLL_TYPE_OUT) == OK) {
9799 uint8_t *buf = out_buf.ptrw ();
98100 if (out_left <= 0 ) {
99- if (out_queue.is_empty ()) {
100- break ; // Nothing left to send
101- }
102101 mutex.lock ();
103- Variant var = out_queue.front ()->get ();
102+ List<Array>::Element *E = out_queue.front ();
103+ if (!E) {
104+ mutex.unlock ();
105+ break ;
106+ }
107+ Variant var = E->get ();
104108 out_queue.pop_front ();
105109 mutex.unlock ();
106110 int size = 0 ;
@@ -163,7 +167,8 @@ Error RemoteDebuggerPeerTCP::connect_to_host(const String &p_host, uint16_t p_po
163167 const int tries = 6 ;
164168 const int waits[tries] = { 1 , 10 , 100 , 1000 , 1000 , 1000 };
165169
166- tcp_client->connect_to_host (ip, port);
170+ Error err = tcp_client->connect_to_host (ip, port);
171+ ERR_FAIL_COND_V_MSG (err != OK, err, vformat (" Remote Debugger: Unable to connect to host '%s:%d'." , p_host, port));
167172
168173 for (int i = 0 ; i < tries; i++) {
169174 tcp_client->poll ();
0 commit comments