diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp
index af0081152620c00c8ec1a5ca12571c9facba9c70..0bd6d5ee8ea83d77a3bc72c399a32c2ef59dc0c2 100644
--- a/source/Lib/EncoderLib/IntraSearch.cpp
+++ b/source/Lib/EncoderLib/IntraSearch.cpp
@@ -4550,7 +4550,7 @@ bool IntraSearch::xRecurIntraCodingACTQT(CodingStructure &cs, Partitioner &parti
     for (int modeIndex = firstCheckId; sps.getUseLFNST() || modeIndex < trModes.size(); modeIndex++)
     {
       const int modeId = sps.getUseLFNST() ? modeIndex : trModes[modeIndex].first;
-      if (modeId > (lossless ? (nNumTransformCands - 1) : lastCheckId))
+      if (modeId > lastCheckId)
       {
         break;
       }