fix some potential empty responses and too much inline calls

This commit is contained in:
iceman1001 committed 2023-08-03 08:41:11 +02:00
1 parent a2ea5e3a24
commit 24a138eeb1
5 files changed
+32 -8

No files matched your search

+4 -4
View File
@@ -742,10 +742,6 @@ static size_t communication_delay(void) {
bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning) {
PacketResponseNG resp;
if (response == NULL) {
response = &resp;
}
// init to ZERO
resp.cmd = 0,
resp.length = 0,
@@ -758,6 +754,10 @@ bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms
resp.oldarg[2] = 0;
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
if (response == NULL) {
response = &resp;
}
// Add delay depending on the communication channel & speed
if (ms_timeout != (size_t) - 1)
ms_timeout += communication_delay();