Christ knew we would need a way to figure out what is the right thing to do even in complex situations that are less obvious, so He said to us that helpful way to know:
Matthew 7:12 In everything, then, do to others as you would have them do to you. For this is the essence of the Law and the Prophets.
As you can see, He said "In everything" meaning in all situations all the time, and He said this "sums up the Law" or is the "essense of the Law" (various translations). In other words, if you can imagine being in his place for a minute (even if mentally off, so long as not under the influence of drugs or other such altering things, etc.) and can imagine then what you'd want if you were in his shoes there...then you can know that way, for sure.
If you realize it's fine according to Christ's way to know, that's enough. If you realize it's bad, or even if you are unsure, you can confess and be forgiven in an instant (1rst John chapter 1), and also be kind to that man if you see him again either way.