diff --git a/Tf/PatAlgorithms/src/PatSeedTrack.h b/Tf/PatAlgorithms/src/PatSeedTrack.h
index ae355dc256969d0c2c95f28a7088ac770c7f7563..ed662e403e2566665c10eaedd9f3b99d15e24212 100644
--- a/Tf/PatAlgorithms/src/PatSeedTrack.h
+++ b/Tf/PatAlgorithms/src/PatSeedTrack.h
@@ -417,7 +417,7 @@ inline int PatSeedTrack::otMonoAsym() const noexcept {
 inline unsigned PatSeedTrack::nHoles() const noexcept {
   unsigned nHoles = 0, i = 0, j = kNPlanes;
   // find first and last plane with hit
-  while ( !m_planeList[i] && i < kNPlanes ) ++i;
+  while ( i < kNPlanes && !m_planeList[i] ) ++i;
   while ( !m_planeList[--j] && j > 0 )
     ;
   for ( ; i <= j; ++i )