[12399] Fix a possible crash for reputation rewarding while rewarded player is teleported out of the map

Also fix build after [12393]

(based on commit [12289] - 741f345)