When the slot of the material is empty, the loop to lock the materials tried to use the material but this was NULL. Check if material is NULL before using it in other operators too.
When the slot of the material is empty, the loop to lock the materials tried to use the material but this was NULL. Check if material is NULL before using it in other operators too.