Please make sure to format your code nicely. This line should read:
if (location != null) {
    return location;
}