From acd65685a06f23e4aae8304e0d81de52b54a1827 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Tue, 27 Mar 2018 19:38:01 +0200 Subject: Fix segmentation fault This bug occurs when the output is blocking, e.g. a pipe and the input has time to fill quicker than with a nonblocking output. --- src/ManagementServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp index 16a21b1..5741e38 100644 --- a/src/ManagementServer.cpp +++ b/src/ManagementServer.cpp @@ -428,7 +428,7 @@ void InputStat::notifyPeakLevels(int peak_left, int peak_right) // Calculate the peak over the short window m_short_window_length = PEAK_STATS_SHORT_WINDOW / insertion_interval; - const size_t short_window = std::max( + const size_t short_window = std::min( m_peaks_left.size(), m_short_window_length); const auto max_left = *max_element(m_peaks_left.begin(), m_peaks_left.begin() + short_window); -- cgit v1.2.3