Or if you want you could just do:

   return 0;  // This should never happen if the histogram and threshold are valid