fix: fixed a crash when the local directory specified in the auth form does not exist

fix #319
This commit is contained in:
veeso
2025-03-15 16:46:57 +01:00
parent dd35fe825c
commit cdf303a847
6 changed files with 46 additions and 24 deletions

View File

@@ -243,14 +243,14 @@ impl FileTransferActivity {
host_bridge_params: HostBridgeParams,
remote_params: &FileTransferParams,
ticks: Duration,
) -> Self {
) -> Result<Self, String> {
// Get config client
let config_client: ConfigClient = Self::init_config_client();
// init host bridge
let host_bridge = HostBridgeBuilder::build(host_bridge_params, &config_client);
let host_bridge = HostBridgeBuilder::build(host_bridge_params, &config_client)?;
let host_bridge_connected = host_bridge.is_localhost();
let enable_fs_watcher = host_bridge.is_localhost();
Self {
Ok(Self {
exit_reason: None,
context: None,
app: Application::init(
@@ -264,7 +264,7 @@ impl FileTransferActivity {
remote_params.protocol,
remote_params.params.clone(),
&config_client,
),
)?,
browser: Browser::new(&config_client),
log_records: VecDeque::with_capacity(256), // 256 events is enough I guess
walkdir: WalkdirStates::default(),
@@ -280,7 +280,7 @@ impl FileTransferActivity {
},
host_bridge_connected,
remote_connected: false,
}
})
}
fn host_bridge(&self) -> &FileExplorer {

View File

@@ -108,6 +108,10 @@ impl Context {
pub fn error(&mut self) -> Option<String> {
self.error.take()
}
pub fn set_error(&mut self, error: String) {
self.error = Some(error);
}
}
impl Drop for Context {