Handle empty peak file as error.

This commit is contained in:
Jonathan Moore Liles 2008-04-16 13:23:34 -05:00
parent 72a203d18b
commit 642d6d48ea
1 changed files with 6 additions and 2 deletions

View File

@ -85,13 +85,17 @@ Peaks::read_peakfile_peaks ( Peak *peaks, nframes_t s, int npeaks, int chunksize
if ( ! ( fp = fopen( peakname( _clip->name() ), "r" ) ) )
{
printf( "failed to open peak file!" );
printf( "failed to open peak file!\n" );
return 0;
}
/* get chunk size of peak file */
int pfchunksize = 0;
fread( &pfchunksize, sizeof( int ), 1, fp );
if ( fread( &pfchunksize, sizeof( int ), 1, fp ) != 1 )
{
printf( "invalid peak file!\n" );
return 0;
}
int channels = _clip->channels();
const int ratio = chunksize / pfchunksize;