Make sure there is a provider before using it

Change-Id: Ief43a067f3ed5df8e5a7d0a1315216dd1106869f