mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Disable audio cache when there is an error trying to create a file
This commit is contained in:
parent
e3abb87da1
commit
f075a75aee
1 changed files with 7 additions and 2 deletions
|
@ -86,8 +86,13 @@ impl Cache {
|
|||
|
||||
mkdir_existing(path.parent().unwrap()).unwrap();
|
||||
|
||||
let mut cache_file = File::create(path).unwrap();
|
||||
::std::io::copy(contents, &mut cache_file).unwrap();
|
||||
let mut cache_file = File::create(path)
|
||||
match cache_file {
|
||||
Ok(file) => ::std::io::copy(contents, &mut file).unwrap(),
|
||||
Err(error) => {
|
||||
self.use_audio_cache = false
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue