How do I find out if a material has particular color property?

I’m am going through all my object and setting their SpecColor to black during gameplay but some of my objects don’t have the SpecColor property. Although this doesn’t seem to cause a problem in game I still get a console error for each object that doesn’t have this type of material.

Material doesn’t have a color property ‘_SpecColor’

I have tried:

oldSpecularColor=this.gameObject.renderer.material.GetColor("_SpecColor");
			
			if(oldSpecularColor!=null)
			{
				this.gameObject.renderer.material.SetColor ("_SpecColor", Color.black);
			}

But the error seems to occur when I try to get the color.
Cheers

Okay I found the answer within seconds of posting the question…(typical) See below…

if(renderer.material.HasProperty("_SpecColor"))
			{
				oldSpecularColor=this.gameObject.renderer.material.GetColor("_SpecColor");
				this.gameObject.renderer.material.SetColor ("_SpecColor", Color.black);
			}