fix(wallpaper): prevent adding same image path multiple times
This commit is contained in:
parent
eb8d0e349f
commit
28c3510671
1 changed files with 4 additions and 0 deletions
|
|
@ -1154,6 +1154,10 @@ impl Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_custom_image(&mut self, path: PathBuf, display: Image, selection: ImageHandle) {
|
fn add_custom_image(&mut self, path: PathBuf, display: Image, selection: ImageHandle) {
|
||||||
|
if self.paths.values().any(|p| p == &path) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let key = self.paths.insert(path);
|
let key = self.paths.insert(path);
|
||||||
self.is_custom.insert(key, ());
|
self.is_custom.insert(key, ());
|
||||||
self.display_images.insert(key, display);
|
self.display_images.insert(key, display);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue