Fixed wrong null check

Is this really wrong? If not the code doesn't make sense