Added check for null, other code above was doing it. Change-Id: I0f58a1957d4586801b98805e0bd9bdcdf115eeb2