Merge "Add a null check to prevent NullPointerException"