mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-27 23:37:05 -05:00
fix: Division by zero in sound visualizer. (#2593)
Can happen if input is less than 2400*channels number of points. The fix is detecting it and throwing an error.
This commit is contained in:
@@ -30,8 +30,10 @@ namespace hex::plugin::visualizers {
|
||||
|
||||
if (sampleRate == 0)
|
||||
throw std::logic_error(fmt::format("Invalid sample rate: {}", sampleRate));
|
||||
else if (channels == 0)
|
||||
if (channels == 0)
|
||||
throw std::logic_error(fmt::format("Invalid channel count: {}", channels));
|
||||
if (downSampling == 0)
|
||||
throw std::logic_error(fmt::format("Invalid down sampling factor: {} / 2400 / {} = {}", wavePattern->getSize(), channels, downSampling));
|
||||
u64 sampledIndex;
|
||||
if (shouldReset) {
|
||||
waveData.clear();
|
||||
|
||||
Reference in New Issue
Block a user