diff options
| author | JosJuice <josjuice@gmail.com> | 2017-06-04 14:30:40 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2017-06-04 14:30:40 +0200 |
| commit | d664c454a4e8935efe202aba6c91a75bb8f3320e (patch) | |
| tree | 4b8c1d32e2e0ac0cd238f4d7e4323f52779118c5 /Source | |
| parent | 60655258875df503bbc47262972622f1c01fc408 (diff) | |
DolphinWX: Don't bind context menu when GC filesystem is invalid
If this isn't done, it's possible to select Extract All Files
and make Dolphin dereference a nullptr m_filesystem.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp | 15 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/ISOProperties/FilesystemPanel.h | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp index 27f96cd3d1..30de05ae5e 100644 --- a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp +++ b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.cpp @@ -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; @@ -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(); @@ -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) diff --git a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.h b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.h index daa285f036..e84e1b5fbe 100644 --- a/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.h +++ b/Source/Core/DolphinWX/ISOProperties/FilesystemPanel.h @@ -39,7 +39,7 @@ private: void CreateGUI(); void BindEvents(); - void PopulateFileSystemTree(); + bool PopulateFileSystemTree(); void OnRightClickTree(wxTreeEvent&); void OnExtractFile(wxCommandEvent&); |
