contacts/editor: fix crash on saving contact
Oops... Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
This commit is contained in:
parent
13e917d97b
commit
8c176d3840
2 changed files with 4 additions and 8 deletions
|
@ -209,7 +209,7 @@ impl Component for ContactManager {
|
|||
match self.form.buttons_result() {
|
||||
None => {}
|
||||
Some(FormButtonAction::Accept) => {
|
||||
let fields = std::mem::take(&mut self.form).collect().unwrap();
|
||||
let fields = std::mem::take(&mut self.form).collect();
|
||||
let fields: IndexMap<String, String> = fields
|
||||
.into_iter()
|
||||
.map(|(s, v)| {
|
||||
|
@ -237,7 +237,7 @@ impl Component for ContactManager {
|
|||
}
|
||||
Some(FormButtonAction::Other("Export")) => {
|
||||
let card = if self.has_changes {
|
||||
let fields = self.form.clone().collect().unwrap();
|
||||
let fields = self.form.clone().collect();
|
||||
let fields: IndexMap<String, String> = fields
|
||||
.into_iter()
|
||||
.map(|(s, v)| {
|
||||
|
|
|
@ -352,12 +352,8 @@ impl<T: 'static + std::fmt::Debug + Copy + Default + Send + Sync> FormWidget<T>
|
|||
&mut self.fields
|
||||
}
|
||||
|
||||
pub fn collect(self) -> Option<HashMap<Cow<'static, str>, Field>> {
|
||||
if self.buttons.result.is_some() {
|
||||
Some(self.fields)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
pub fn collect(self) -> HashMap<Cow<'static, str>, Field> {
|
||||
self.fields
|
||||
}
|
||||
|
||||
pub fn buttons_result(&mut self) -> Option<T> {
|
||||
|
|
Loading…
Add table
Reference in a new issue