Merge "Add a null check to prevent NPE" into nyc-dev