Disallow empty group call identifier in requests.

This commit is contained in:
levlam 2020-11-26 13:44:48 +03:00
parent 5cfda1df72
commit 2f1b857b7e
2 changed files with 5 additions and 2 deletions

View File

@ -15,8 +15,11 @@ InputGroupCallId::InputGroupCallId(const tl_object_ptr<telegram_api::inputGroupC
: group_call_id(input_group_call->id_), access_hash(input_group_call->access_hash_) {
}
Result<InputGroupCallId> InputGroupCallId::from_group_call_id(const string &group_call_id) {
Result<InputGroupCallId> InputGroupCallId::from_group_call_id(const string &group_call_id, bool allow_empty) {
if (group_call_id.empty()) {
if (!allow_empty) {
return Status::Error(400, "Empty group call identifier specified");
}
return InputGroupCallId();
}

View File

@ -28,7 +28,7 @@ class InputGroupCallId {
InputGroupCallId(int64 group_call_id, int64 access_hash) : group_call_id(group_call_id), access_hash(access_hash) {
}
static Result<InputGroupCallId> from_group_call_id(const string &group_call_id);
static Result<InputGroupCallId> from_group_call_id(const string &group_call_id, bool allow_empty = false);
string get_group_call_id() const;