return when error is occurs

client is null, which causes an error on the next line.