Don't crash on nullptr passed to td_json_client.
GitOrigin-RevId: b064ab5d839a5747d9bf1d289238fa77da219585
This commit is contained in:
parent
db218463d1
commit
dd9964ae3a
@ -23,7 +23,7 @@ void td_json_client_destroy(void *client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void td_json_client_send(void *client, const char *request) {
|
void td_json_client_send(void *client, const char *request) {
|
||||||
static_cast<td::ClientJson *>(client)->send(td::Slice(request));
|
static_cast<td::ClientJson *>(client)->send(td::Slice(request == nullptr ? "" : request));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *td_json_client_receive(void *client, double timeout) {
|
const char *td_json_client_receive(void *client, double timeout) {
|
||||||
@ -36,7 +36,7 @@ const char *td_json_client_receive(void *client, double timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *td_json_client_execute(void *client, const char *request) {
|
const char *td_json_client_execute(void *client, const char *request) {
|
||||||
auto slice = static_cast<td::ClientJson *>(client)->execute(td::Slice(request));
|
auto slice = static_cast<td::ClientJson *>(client)->execute(td::Slice(request == nullptr ? "" : request));
|
||||||
if (slice.empty()) {
|
if (slice.empty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user