From 97fff931fde1e6d2f988cc7e6abed5234850b18c Mon Sep 17 00:00:00 2001 From: JosJuice Date: Mon, 20 Apr 2026 19:17:03 +0200 Subject: [PATCH] DiscIO: Add extra IsValid checks for VolumeWAD::m_tmd Plus an IsValid check inside TMDReader::GetContents, which is called by VolumeWAD. Fixes https://bugs.dolphin-emu.org/issues/14032. --- Source/Core/Core/IOS/ES/Formats.cpp | 2 +- Source/Core/DiscIO/VolumeWad.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp index a43ff50de5..c28651bae7 100644 --- a/Source/Core/Core/IOS/ES/Formats.cpp +++ b/Source/Core/Core/IOS/ES/Formats.cpp @@ -339,7 +339,7 @@ bool TMDReader::GetContent(u16 index, Content* content) const std::vector TMDReader::GetContents() const { - std::vector contents(GetNumContents()); + std::vector contents(IsValid() ? GetNumContents() : 0); for (size_t i = 0; i < contents.size(); ++i) GetContent(static_cast(i), &contents[i]); return contents; diff --git a/Source/Core/DiscIO/VolumeWad.cpp b/Source/Core/DiscIO/VolumeWad.cpp index 95c6a68dc6..39961a6c18 100644 --- a/Source/Core/DiscIO/VolumeWad.cpp +++ b/Source/Core/DiscIO/VolumeWad.cpp @@ -230,11 +230,17 @@ IOS::ES::TicketReader VolumeWAD::GetTicketWithFixedCommonKey() const std::string VolumeWAD::GetGameID(const Partition& partition) const { + if (!m_tmd.IsValid()) + return {}; + return m_tmd.GetGameID(); } std::string VolumeWAD::GetGameTDBID(const Partition& partition) const { + if (!m_tmd.IsValid()) + return {}; + return m_tmd.GetGameTDBID(); }