Fix crash with several materials on a mesh when applying a new material on an already painted selection