mirror of
https://github.com/miek/inspectrum.git
synced 2026-03-03 06:54:17 +01:00
Fixed #12 - no longer segfaults from small file sizes
This commit is contained in:
@@ -93,6 +93,10 @@ void InputSource::GetViewport(float *dest, int x, int y, int width, int height,
|
||||
fftwf_complex *sample_ptr = &m_data[y * GetFFTStride()];
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
// Abort if sampling more data than is actually available
|
||||
if (sample_ptr > m_data + (m_file_size/sizeof(fftwf_complex)))
|
||||
break;
|
||||
|
||||
memcpy(m_fftw_in, sample_ptr, m_fft_size * sizeof(fftwf_complex));
|
||||
|
||||
// Apply window
|
||||
|
||||
Reference in New Issue
Block a user