Fixed crash when an empty string is used in the asset browser search

This commit is contained in:
Adrien GIVRY
2025-04-28 18:19:24 -04:00
parent 64c9caf76a
commit 4f242b1ad3
+8 -1
View File
@@ -1134,7 +1134,14 @@ impl AssetBrowser {
&& message.direction() == MessageDirection::FromWidget
{
if search_text.is_empty() {
let path = self.selected_item_path.parent().unwrap().to_path_buf();
let path = if self.selected_item_path != PathBuf::default() {
self.selected_item_path
.parent()
.map(|p| p.to_path_buf())
.unwrap_or_else(|| PathBuf::from("./"))
} else {
PathBuf::from("./")
};
self.item_to_select = Some(self.selected_item_path.clone());
self.set_path(&path, ui, &engine.resource_manager, &sender);
} else {