Ok two things.
First I’d like to see your variable details.
And then you will have to fill the variable and not just create it. Your errors are there because nothing is inside of that variable. It’s a reference to none or null which are will result in an error if you try to do something with it other than removing a m material from a mesh.