Initialize server->serial in all cases

Running scrcpy --tcpip on a device already connected via TCP/IP did not
initialize server->serial.

As a consequence, in debug mode, an assertion failed:

    scrcpy: ../app/src/server.c:770: run_server: Assertion
    `server->serial' failed.

In release mode, scrcpy failed with this error:

    adb: -s requires an argument
This commit is contained in:
Romain Vimont 2023-02-28 12:34:34 +01:00
parent 6b422e21bf
commit 3c3c07db05

View file

@ -689,6 +689,11 @@ sc_server_configure_tcpip_unknown_address(struct sc_server *server,
if (is_already_tcpip) {
// Nothing to do
LOGI("Device already connected via TCP/IP: %s", serial);
server->serial = strdup(serial);
if (!server->serial) {
LOG_OOM();
return false;
}
return true;
}