Assert instead of returning empty event on invalid index

This commit is contained in:
Robert Müller 2023-04-21 18:29:31 +02:00
parent cdd19beee4
commit 8b26fa0bc3

View file

@ -58,11 +58,7 @@ public:
virtual bool IsEventValid(CEvent *pEvent) const = 0; virtual bool IsEventValid(CEvent *pEvent) const = 0;
CEvent GetEvent(int Index) const CEvent GetEvent(int Index) const
{ {
if(Index < 0 || Index >= m_NumEvents) dbg_assert(Index >= 0 && Index < m_NumEvents, "Index invalid");
{
IInput::CEvent e = {0, 0};
return e;
}
return m_aInputEvents[Index]; return m_aInputEvents[Index];
} }
CEvent *GetEventsRaw() { return m_aInputEvents; } CEvent *GetEventsRaw() { return m_aInputEvents; }