Skip to content

Commit

Permalink
fix: prevent crash if mbtiles file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Jun 9, 2022
1 parent 1083785 commit 2cf5e83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ fn setup_mbtiles(key: String, path: Option<String>, window: Window) {
if path.is_none() {
return;
}
let path_buf = PathBuf::from(path.clone().unwrap());
if !path_buf.exists() {
return;
}
let window_ = window.clone();
let mb_tiles_id = format!("{:x}", md5::compute(path.clone().unwrap().as_bytes()));

// println!("mbTilesId {} {}", path.clone().unwrap(), mb_tiles_id);
set_mbtiles(
&mb_tiles_id,
PathBuf::from(path.unwrap().clone()),
path_buf,
Box::new(move |mb_tiles_id| {
window_
.emit_all(
Expand Down

0 comments on commit 2cf5e83

Please sign in to comment.