What to do with if( 0 != id.rawId() ) condition? It seems to be redundant. Moreover in original code if it does not fulfill the code will break since m_borderPtrVec will be null and ptr = (*m_borderPtrVec)[ iPhi - 1 + ( 0>iz ? 0 : 360 ) ] ; will access null ptr.