Check the method rather than the variable to prevent null pointers.