prevent "enter/save" key callback if string is empty (#509)

Co-authored-by: SG <who.just.the.doctor@gmail.com>
This commit is contained in:
its your bedtime 2021-06-07 18:49:56 +03:00 committed by GitHub
parent f817d45d27
commit 3c6f236df3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,7 +289,7 @@ static void text_input_handle_ok(TextInput* text_input) {
uint8_t text_length = strlen(model->text);
if(selected == ENTER_KEY) {
if(model->callback != 0) {
if(model->callback != 0 && text_length > 0) {
model->callback(model->callback_context, model->text);
}
} else if(selected == BACKSPACE_KEY) {