nickgillian / grt

gesture recognition toolkit
859 stars 285 forks source link

bug in addPreProcessingModule and fix #109

Open codeflakes0 opened 7 years ago

codeflakes0 commented 7 years ago

in the following code:

bool GestureRecognitionPipeline::addPreProcessingModule(const PreProcessing &preProcessingModule,UINT insertIndex){

    //Validate the insertIndex is valid
    if( insertIndex != INSERT_AT_END_INDEX && insertIndex >= preProcessingModules.getSize() ){
        errorLog << __FILENAME__ << "Invalid insertIndex value!" << std::endl;
        return false;
}

the ">=" should be only ">" or else you can never add a preprocessing module. If you want to add your first preprocessing at index 0 you can't fail if preProcessingModules.getSize() == 0.

if( insertIndex != INSERT_AT_END_INDEX && insertIndex > preProcessingModules.getSize()

Problem is the same with "addFeatureExtractionModule".