Make sure there is a provider before using it

Change-Id: Ief43a067f3ed5df8e5a7d0a1315216dd1106869f
(cherry picked from commit 005275ec2b545cf2753f959bec8e0d38db82bb68)