Messi was lucky not to get a second yellow there. Nobody could have any complaints had the ref gave him a second yellow. However, it was in the middle of the pitch and there was no malice intended, he obviously was trying to get the ball, even though that counts for little since he didn't get any of the ball, but the ref can still justify not giving him a second yellow.