Added null checks for PluginImpl

This is needed when other plugins add this
plugin as an optional dependency.

Change-Id: If433788805ded7ab163b5b90b9f977eca4b6e691