diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c
index a72b22b5a62b953bbccde13f271c76fb6e24cad1..287a185bc36b06b5d04cc18d5667b9e869047452 100644
--- a/src/lua_hooklib.c
+++ b/src/lua_hooklib.c
@@ -1117,7 +1117,7 @@ int LUA_HookMusicChange(const char *oldname, struct MusicChange *param)
 		lua_pushstring(gL, oldname);/* the only constant value */
 		lua_pushstring(gL, param->newname);/* semi constant */
 
-		for (k = 0; k <= map->numHooks; ++k)
+		for (k = 0; k < map->numHooks; ++k)
 		{
 			get_hook(&hook, map->ids, k);