Added check for token NULL value before saving following 401 

If the token header is NULL (as it would be for a 401) and this is saved, the subsequent authorisation attempt is impossible since the existing token has been overwritten.