Skip to content

Commit

Permalink
Fixed crash caused by key mismatch
Browse files Browse the repository at this point in the history
relPath was added to "." while relPath.parent_path() could give "" causing an exception since there's no entry allocated for added for ""
  • Loading branch information
QueenPrinsessa committed Jul 13, 2024
1 parent ac449d7 commit 6120060
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ Ref<AssetBrowser::DirectoryItem> AssetDirectoryProcessor::ProcessDirectories(con
{
auto relPath = Volt::AssetManager::GetRelativePath(entry.path);
Ref<AssetBrowser::DirectoryItem> dirData = CreateRef<AssetBrowser::DirectoryItem>(m_selectionManager.Get(), relPath);
directoryItems[relPath] = dirData;
directoryItems[relPath.parent_path()]->subDirectories.emplace_back(dirData);
dirData->parentDirectory = directoryItems[relPath.parent_path()].get();
directoryItems[relPath] = dirData;
const auto parentPath = Volt::AssetManager::GetRelativePath(entry.path.parent_path());
directoryItems[parentPath]->subDirectories.emplace_back(dirData);
dirData->parentDirectory = directoryItems[parentPath].get();
}
else
{
Expand All @@ -74,8 +75,9 @@ Ref<AssetBrowser::DirectoryItem> AssetDirectoryProcessor::ProcessDirectories(con
if (m_assetMask == Volt::AssetType::None || (m_assetMask & type) != Volt::AssetType::None)
{
auto relPath = Volt::AssetManager::GetRelativePath(entry.path);
Ref<AssetBrowser::AssetItem> assetItem = CreateRef<AssetBrowser::AssetItem>(m_selectionManager.Get(), relPath, meshImportData, meshToImportData);
directoryItems[relPath.parent_path()]->assets.emplace_back(assetItem);
Ref<AssetBrowser::AssetItem> assetItem = CreateRef<AssetBrowser::AssetItem>(m_selectionManager.Get(), relPath, meshImportData, meshToImportData);
const auto parentPath = Volt::AssetManager::GetRelativePath(entry.path.parent_path());
directoryItems[parentPath]->assets.emplace_back(assetItem);
}
}
}
Expand Down

0 comments on commit 6120060

Please sign in to comment.