The Harry Potter author leapt to the defence of the former Olympic swimmer after seeing a mocking post on social media.