Check null before grabbing owning plugin

The null validation check comes after the owning plugin is extracted from it, resulting in a possible NPE if a null value is passed to the method.