check if result is null before parsing results