Shader change problem

I don’t know why this code does not work.

Error says ,

NullReferenceException
UI.UpdateHotkeys () (at Assets\Scripts\UI\UI.js:301)
UI.Update () (at Assets\Scripts\UI\UI.js:68)

private var rend : Transform;
function Start(){
	rend = transform.Find("Bip01_Pelvis");
}

function Update(){
if(Input.GetKeyDown("1"))
	{
var rendshad : Renderer = rend.GetComponent(Renderer);

rendshad.material.shader = Shader.Find("Particles/Additive");	 
	}	
}

Bip01_Pelvis has two Materials, I want to change them all or just second one.

And how to access to second or third, materials?

In case of renderer has many materials.

This solved.

Another q.

How to preserve the current shader set? (e.g. Diffuse)

For usage of backwards to preserved shader after change to another set.

There is actually a shader class defined, so you can store a reference to the shader in a variable. If you need to change shaders several times but then backtrack to whatever you were using previously, then a stack data structure might be what you need.