workaround config crash since cursive 0.5.1

https://github.com/gyscos/Cursive/issues/144
This commit is contained in:
Scott Lamb 2017-07-02 22:03:16 -07:00
parent ac43e7fe17
commit 8ff1d0dcb8

View File

@ -42,17 +42,23 @@ use super::{decode_size, encode_size};
/// Builds a `CameraChange` from an active `edit_camera_dialog`. /// Builds a `CameraChange` from an active `edit_camera_dialog`.
fn get_change(siv: &mut Cursive) -> db::CameraChange { fn get_change(siv: &mut Cursive) -> db::CameraChange {
// Note: these find_id calls are separate statements, which seems to be important:
// https://github.com/gyscos/Cursive/issues/144
let sn = siv.find_id::<views::EditView>("short_name").unwrap().get_content().as_str().into();
let d = siv.find_id::<views::TextArea>("description").unwrap().get_content().into();
let h = siv.find_id::<views::EditView>("host").unwrap().get_content().as_str().into();
let u = siv.find_id::<views::EditView>("username").unwrap().get_content().as_str().into();
let p = siv.find_id::<views::EditView>("password").unwrap().get_content().as_str().into();
let m = siv.find_id::<views::EditView>("main_rtsp_path").unwrap().get_content().as_str().into();
let s = siv.find_id::<views::EditView>("sub_rtsp_path").unwrap().get_content().as_str().into();
db::CameraChange{ db::CameraChange{
short_name: siv.find_id::<views::EditView>("short_name") short_name: sn,
.unwrap().get_content().as_str().into(), description: d,
description: siv.find_id::<views::TextArea>("description").unwrap().get_content().into(), host: h,
host: siv.find_id::<views::EditView>("host").unwrap().get_content().as_str().into(), username: u,
username: siv.find_id::<views::EditView>("username").unwrap().get_content().as_str().into(), password: p,
password: siv.find_id::<views::EditView>("password").unwrap().get_content().as_str().into(), main_rtsp_path: m,
main_rtsp_path: siv.find_id::<views::EditView>("main_rtsp_path") sub_rtsp_path: s,
.unwrap().get_content().as_str().into(),
sub_rtsp_path: siv.find_id::<views::EditView>("sub_rtsp_path")
.unwrap().get_content().as_str().into(),
} }
} }