Skip to content

Commit

Permalink
Fixed #12 - no longer segfaults from small file sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
philpax committed Jul 10, 2015
1 parent d206146 commit ad6759e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inputsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ad6759e

Please sign in to comment.