From fbed0b4a9c0e64617c49592b70bbeda6abecb468 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 25 Apr 2015 15:33:20 +0200 Subject: [PATCH] ISOProperties: Correctly handle partitions with 0 files --- Source/Core/DolphinWX/ISOProperties.cpp | 12 ++++++++++-- Source/Core/DolphinWX/ISOProperties.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/ISOProperties.cpp b/Source/Core/DolphinWX/ISOProperties.cpp index f2ef327c10..b1ec1260a3 100644 --- a/Source/Core/DolphinWX/ISOProperties.cpp +++ b/Source/Core/DolphinWX/ISOProperties.cpp @@ -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 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 fileInfos, const size_t _FirstIndex, diff --git a/Source/Core/DolphinWX/ISOProperties.h b/Source/Core/DolphinWX/ISOProperties.h index cf771942ff..36c539bbbc 100644 --- a/Source/Core/DolphinWX/ISOProperties.h +++ b/Source/Core/DolphinWX/ISOProperties.h @@ -221,6 +221,8 @@ private: std::vector GCFiles; typedef std::vector::iterator fileIter; + size_t CreateDirectoryTree(wxTreeItemId& parent, + std::vector fileInfos); size_t CreateDirectoryTree(wxTreeItemId& parent, std::vector fileInfos, const size_t _FirstIndex,