From 008f8a1e199554fcfc3dc41ecae012575f69d82a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 22 May 2021 08:39:05 +0300 Subject: Fix mod 0 crash --- src/audio/AudioLogic.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/audio/AudioLogic.cpp') diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index f1fa795f..38836c3c 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -5469,6 +5469,11 @@ cAudioManager::GetPedCommentSfx(CPed *ped, int32 sound) void cAudioManager::GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const { + if (maxOffset == 0) { + phrase = prevPhrase = NO_SAMPLE; + return; + } + phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] % maxOffset; // check if the same sfx like last time, if yes, then try use next one, -- cgit v1.2.3