|
[yoda-svn] r496 - trunk/include/YODAblackhole at projects.hepforge.org blackhole at projects.hepforge.orgThu Jul 12 11:44:22 BST 2012
Author: dgrell Date: Thu Jul 12 11:44:22 2012 New Revision: 496 Log: Segfault catch if binhash is empty Modified: trunk/include/YODA/Axis1D.h Modified: trunk/include/YODA/Axis1D.h ============================================================================== --- trunk/include/YODA/Axis1D.h Wed Jul 11 17:56:58 2012 (r495) +++ trunk/include/YODA/Axis1D.h Thu Jul 12 11:44:22 2012 (r496) @@ -183,7 +183,7 @@ /// Returns an index of a bin at a given coord, -1 if no bin matches long int getBinIndex(double coord) const { // First check that we are within the axis bounds at all - if (coord < lowEdge() || coord > highEdge()) return -1; + if (_binhash.empty() || coord < lowEdge() || coord > highEdge()) return -1; // Then return the lower-edge lookup from the hash map. // NB. both upper_bound and lower_bound return values *greater* than (or equal) to coord, // so we have to step back one iteration to get to the lower-or-equal containing bin edge. @@ -388,6 +388,7 @@ /// Check if there are any bin edges between values @a from and @a to. bool _edgeInRange(double from, double to) const { + if ( _binhash.empty() ) return false; return (--_binhash.upper_bound(from)) != (--_binhash.lower_bound(to)); }
More information about the yoda-svn mailing list |