Don't run games set in the real world, or settings that are only one step away from it.
Mostly this. These days, I very much prefer my fantasy settings to be exactly that -
fantasy settings. So the default land is
not "fantasy Europe", the lands to the east are
not "fantasy Asia", and so on. Simply taking a real-world nation and filing off the serial numbers is... okay, I guess, but it's just not what I'm looking for in a setting these days.
But in addition:
There will never be one sure-fire solution that a DM or writer can use as a shield from criticism. But the shield of "I tried my best to cover the bases." is usually a pretty good one. Few people will fault you for putting in your best effort, so I guess what it really comes down to is this:
Did you put in your best effort?
This is pretty much it. The truth is that if you put something out there, there's a good chance
somebody will take offense - because you didn't include their favoured group, or you did but you got some detail wrong (or, indeed, maybe you got it right and
they're in the wrong - that won't stop them being offended!). Heck, I might even argue that if you're product doesn't have at least the potential to offend, it's probably so bland you might as well not bother.
So, make your best effort, and then don't worry about it. And if you do screw up and get something offensively wrong, apologise for the offense caused and try harder next time.