Add Guard against NULL pointer