Skip to content

Commit

Permalink
Merge pull request #5534 from JosJuice/dont-bind-no-filesystem
Browse files Browse the repository at this point in the history
DolphinWX: Don't bind context menu when GC filesystem is invalid
  • Loading branch information
leoetlino committed Jun 4, 2017
2 parents 145483d + d664c45 commit 4e584ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp
Expand Up @@ -159,10 +159,11 @@ FilesystemPanel::FilesystemPanel(wxWindow* parent, wxWindowID id,
: wxPanel{parent, id}, m_opened_iso{opened_iso}
{
CreateGUI();
BindEvents();
PopulateFileSystemTree();

m_tree_ctrl->Expand(m_tree_ctrl->GetRootItem());
if (PopulateFileSystemTree())
{
BindEvents();
m_tree_ctrl->Expand(m_tree_ctrl->GetRootItem());
}
}

FilesystemPanel::~FilesystemPanel() = default;
Expand Down Expand Up @@ -194,7 +195,7 @@ void FilesystemPanel::CreateGUI()
SetSizer(main_sizer);
}

void FilesystemPanel::PopulateFileSystemTree()
bool FilesystemPanel::PopulateFileSystemTree()
{
const std::vector<DiscIO::Partition> partitions = m_opened_iso->GetPartitions();
m_has_partitions = !partitions.empty();
Expand Down Expand Up @@ -224,10 +225,12 @@ void FilesystemPanel::PopulateFileSystemTree()
{
m_filesystem = DiscIO::CreateFileSystem(m_opened_iso.get(), DiscIO::PARTITION_NONE);
if (!m_filesystem)
return;
return false;

CreateDirectoryTree(m_tree_ctrl, m_tree_ctrl->GetRootItem(), m_filesystem->GetFileList());
}

return true;
}

void FilesystemPanel::OnRightClickTree(wxTreeEvent& event)
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinWX/ISOProperties/FilesystemPanel.h
Expand Up @@ -39,7 +39,7 @@ class FilesystemPanel final : public wxPanel
void CreateGUI();
void BindEvents();

void PopulateFileSystemTree();
bool PopulateFileSystemTree();

void OnRightClickTree(wxTreeEvent&);
void OnExtractFile(wxCommandEvent&);
Expand Down

0 comments on commit 4e584ec

Please sign in to comment.