Skip to content

Commit

Permalink
Avoid crash if wave remainer is not specified in caller, which is all…
Browse files Browse the repository at this point in the history
…owed by api.
  • Loading branch information
nshmyrev committed Sep 21, 2015
1 parent 662b568 commit e37685f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/feat/feature-fbank.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ void Fbank::ComputeInternal(const VectorBase<BaseFloat> &wave,
int32 cols_out = opts_.mel_opts.num_bins + opts_.use_energy;
if (rows_out == 0) {
output->Resize(0, 0);
*wave_remainder = wave;
if (wave_remainder != NULL)
*wave_remainder = wave;
return;
}
// Prepare the output buffer
Expand Down
3 changes: 2 additions & 1 deletion src/feat/feature-mfcc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ void Mfcc::ComputeInternal(const VectorBase<BaseFloat> &wave,
cols_out = opts_.num_ceps;
if (rows_out == 0) {
output->Resize(0, 0);
*wave_remainder = wave;
if (wave_remainder != NULL)
*wave_remainder = wave;
return;
}
output->Resize(rows_out, cols_out);
Expand Down
3 changes: 2 additions & 1 deletion src/feat/feature-plp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ void Plp::ComputeInternal(const VectorBase<BaseFloat> &wave,
cols_out = opts_.num_ceps;
if (rows_out == 0) {
output->Resize(0, 0);
*wave_remainder = wave;
if (wave_remainder != NULL)
*wave_remainder = wave;
return;
}
output->Resize(rows_out, cols_out);
Expand Down

0 comments on commit e37685f

Please sign in to comment.