Adding null check on getAddresses