client: fix potential NULL dereference