Added a check incase the initState method is called late.