Fixed #12 - no longer segfaults from small file sizes

This commit is contained in:
Philpax
2015-07-10 13:42:29 +10:00
parent d206146fe1
commit ad6759e993

View File

@@ -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