Fixed a null check on a local variable instead of the object's global variable.