Replace raw JS null check with CS version