Index: trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 313)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 314)
@@ -345,5 +345,5 @@
 
 #if JCTVC_M0259_LAMBDAREFINEMENT
-  if( rpcSlice->getLayerId() > 0 && depth >= 3 && m_pcCfg->getGOPSize() == ( 1 << depth ) )
+  if( rpcSlice->getLayerId() > 0 && rpcSlice->getActiveNumILRRefIdx() && depth >= 3 && m_pcCfg->getGOPSize() == ( 1 << depth ) )
   {
     Int nCurLayer = rpcSlice->getLayerId();
@@ -373,5 +373,5 @@
   weight = pow( 2.0, (iQP-g_aucChromaScale[qpc])/3.0 );  // takes into account of the chroma qp mapping and chroma qp Offset
 #if JCTVC_M0259_LAMBDAREFINEMENT
-  if( rpcSlice->getLayerId() > 0 && m_pcCfg->getGOPSize() >= 8 && rpcSlice->isIntra() == false && depth == 0 )
+  if( rpcSlice->getLayerId() > 0 && rpcSlice->getActiveNumILRRefIdx() && m_pcCfg->getGOPSize() >= 8 && rpcSlice->isIntra() == false && depth == 0 )
   {
     dLambda *= 1.1;
