Could you please insert 
CV_Assert(!dextractor.empty());
here (before using the dextractor in the next line) ?
It was not in the original code, but it would be right to have it.