Check to make sure provider isn't null before detaching it