That was an error, but it was caught before the departing aircraft entered the runway, otherwise the landing aircraft would have been told to go around. The landing aircraft's pilot did a good job reminding the controller that he was on a short final after the controller issued the departing aircraft a takeoff clearance. There was, however, no runway incursion.