Skip in-use voices with 0 channels to avoid null pointer dereferences. Fixes audio crashing in Xenoblade Chronicles 2

This commit is contained in:
Kelebek1
2021-06-24 18:23:37 +01:00
parent 4dc2f5a341
commit c2e62f6955

View File

@@ -168,7 +168,8 @@ bool InfoUpdater::UpdateVoices(VoiceContext& voice_context,
auto& voice_in_params = voice_in[i];
const auto channel_count = static_cast<std::size_t>(voice_in_params.channel_count);
// Skip if it's not currently in use
if (!voice_in_params.is_in_use) {
// TODO: in-use voices shouldn't have 0 channels, investigate why this happens
if (!voice_in_params.is_in_use || channel_count == 0) {
continue;
}
// Voice states for each channel