Check if clip exists in Animator

How do I check if an animation clip exists in the controller attached to the animator component?

When a clip doesn’t exist I get an error.

Animator.GotoState: State could not be found UnityEngine.Animator:Play(String).

So I need something like

if(hasClip("idle"))
    GetComponent<Animator> ().Play ("idle");

I know of Animation but that is deprecated, so how do I do this with Animator in Uity 4? I am not using Legacy.

I believe HasState() has been added with Unity 5 (however I do not see it available in my current Unity 4.6.9 project)

https://unity3d.com/learn/tutorials/modules/beginner/animation/animator-scripting

See StringToHash example too