Fix null pointer access

Provider attribute as user defined has possibility not to exist.
So you need to check pointer before calling methods.