check shader property if exist

how can check if propery in shader exist?

i tryed :

if != null

try

every time, i get error

Material doesn't have a texture property '_MainTex'
UnityEngine.Material:get_mainTexture()

if(renderer.material.HasProperty(“_Color”))
renderer.material.SetColor(“_Color”,Color.red);