diff --git a/stepmania/src/UnlockManager.cpp b/stepmania/src/UnlockManager.cpp index 9b18f99619..600146cf0c 100644 --- a/stepmania/src/UnlockManager.cpp +++ b/stepmania/src/UnlockManager.cpp @@ -713,7 +713,7 @@ public: static int GetNumUnlocks( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlocks() ); return 1; } static int GetNumUnlocked( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumUnlocked() ); return 1; } static int AnyUnlocksToCelebrate( T* p, lua_State *L ) { lua_pushboolean( L, p->AnyUnlocksToCelebrate() ); return 1; } - static int GetUnlockEntry( T* p, lua_State *L ) { int iIndex = IArg(1); p->m_UnlockEntries[iIndex].PushSelf(L); return 1; } + static int GetUnlockEntry( T* p, lua_State *L ) { int iIndex = IArg(1); if( iIndex >= p->m_UnlockEntries.size() ) return 0; p->m_UnlockEntries[iIndex].PushSelf(L); return 1; } static int GetSongsUnlockedByEntryID( T* p, lua_State *L ) { vector apSongs;