modals: refuse to build modal if no fields have been provided

This commit is contained in:
Gianguido Sorà 2022-04-13 16:59:17 +02:00
parent 0c17bb6e34
commit d06c6dcb32

View file

@ -30,6 +30,12 @@ impl<'a> AlertModalBuilder<'a> {
let mut final_placeholders: Option<[Option<xous_ipc::String<256>>; 10]> = None;
let fields_amt = self.validators.len();
if fields_amt == 0 {
log::error!("must add at least one field to alert");
self.modals.unlock();
return Err(xous::Error::UnknownError);
}
match self.placeholders.len() {
1.. => {
let mut pl:[Option<xous_ipc::String<256>>; 10] = Default::default();