diff --git a/src/engine/shared/demo.cpp b/src/engine/shared/demo.cpp index 958634642..148541565 100644 --- a/src/engine/shared/demo.cpp +++ b/src/engine/shared/demo.cpp @@ -738,8 +738,8 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const // get timeline markers int Num = ((m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[0]<<24)&0xFF000000) | ((m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[1]<<16)&0xFF0000) | ((m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[2]<<8)&0xFF00) | (m_Info.m_TimelineMarkers.m_aNumTimelineMarkers[3]&0xFF); - m_Info.m_Info.m_NumTimelineMarkers = Num; - for(int i = 0; i < Num && i < MAX_TIMELINE_MARKERS; i++) + m_Info.m_Info.m_NumTimelineMarkers = min(Num, (int)MAX_TIMELINE_MARKERS); + for(int i = 0; i < m_Info.m_Info.m_NumTimelineMarkers; i++) { char *pTimelineMarker = m_Info.m_TimelineMarkers.m_aTimelineMarkers[i]; m_Info.m_Info.m_aTimelineMarkers[i] = ((pTimelineMarker[0]<<24)&0xFF000000) | ((pTimelineMarker[1]<<16)&0xFF0000) |