Well I've never tried setting a texture myself but you probably would want to use a different material then that doesn't access the 5th skin when the model has none. Or just call SetTexture for a small dummy black skin if you're using it for a mask/ data/ whatever. Keep in mind that you should not do unnecessary SetTexture calls to not waste performance though.