Check once that key is non-nil

We have to check that the key in the reply is not nil. If we don't and
key is nil then the call to the caseInsensitiveCompare: method will
return nill, and since NSOrderedSame is zero then both sides of the
equal sign will be the same and the condition will be true. So we have
to check that key is non-nil. We do so in each if-condition, which is a
bit error-prone. Instead check once that key is non-nil and only check
which key it is within that block.

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>