diff --git a/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/Emu/Cell/Modules/cellMic.cpp index 98e4692927..0cad02959d 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -590,8 +590,8 @@ f32 microphone_device::calculate_energy_level() sum_squares += normalized_sample * normalized_sample; } - const f32 rms = std::sqrt(sum_squares / num_samples); - const f32 decibels_max = 90.0f; + const f32 rms = num_samples > 0 ? std::sqrt(sum_squares / num_samples) : 0.0f; + constexpr f32 decibels_max = 90.0f; const f32 decibels_relative = 20.0f * std::log10(std::max(rms, 0.00001f)); const f32 decibels = decibels_max + (decibels_relative * 0.5f);