ISOProperties: Correctly handle partitions with 0 files

This commit is contained in:
JosJuice 2015-04-25 15:33:20 +02:00
parent 645aa5af8b
commit fbed0b4a9c
2 changed files with 12 additions and 2 deletions

View File

@ -255,7 +255,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
wxTreeItemId PartitionRoot =
m_Treectrl->AppendItem(RootId, wxString::Format(_("Partition %i"), partition_count), 0, 0);
m_Treectrl->SetItemData(PartitionRoot, new WiiPartition(partition));
CreateDirectoryTree(PartitionRoot, partition.Files, 1, partition.Files.at(0)->m_FileSize);
CreateDirectoryTree(PartitionRoot, partition.Files);
if (partition_count == 1)
m_Treectrl->Expand(PartitionRoot);
partition_count++;
@ -275,7 +275,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
if (pFileSystem)
pFileSystem->GetFileList(GCFiles);
if (!GCFiles.empty())
CreateDirectoryTree(RootId, GCFiles, 1, GCFiles.at(0)->m_FileSize);
CreateDirectoryTree(RootId, GCFiles);
}
m_Treectrl->Expand(RootId);
@ -292,6 +292,14 @@ CISOProperties::~CISOProperties()
delete OpenISO;
}
size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent, std::vector<const DiscIO::SFileInfo*> fileInfos)
{
if (fileInfos.empty())
return 0;
else
return CreateDirectoryTree(parent, fileInfos, 1, fileInfos.at(0)->m_FileSize);
}
size_t CISOProperties::CreateDirectoryTree(wxTreeItemId& parent,
std::vector<const DiscIO::SFileInfo*> fileInfos,
const size_t _FirstIndex,

View File

@ -221,6 +221,8 @@ private:
std::vector<const DiscIO::SFileInfo*> GCFiles;
typedef std::vector<const DiscIO::SFileInfo*>::iterator fileIter;
size_t CreateDirectoryTree(wxTreeItemId& parent,
std::vector<const DiscIO::SFileInfo*> fileInfos);
size_t CreateDirectoryTree(wxTreeItemId& parent,
std::vector<const DiscIO::SFileInfo*> fileInfos,
const size_t _FirstIndex,