Fix issue #1275 - wielded index greater than inv size.

Bugfix for https://github.com/minetest/minetest/issues/1275