For starters, you have a fuel filter. This does exactly what it says: filters out any debris or impurities that might have gotten into your gas tank somehow. So if there were little sugar crystals in your gasoline, the fuel filter would stop them before they could damage the engine.
Then there's the fact that plain old sugar does not dissolve in gasoline; it just sinks to the bottom of the gas tank.
A University of California, Berkeley researcher tested this myth experimentally way back in 1994 by putting sugar into gasoline and then spinning it in a centrifuge. He measured how much undissolved sugar spun out of the fluid and then calculated how much sugar remained dissolved in the gasoline. It was less than a teaspoon for 15 gallons of gas – more than a full tank in many cars.
Even if you have less than a full tank and someone dumps sugar in there, the fluid can only incorporate so much sugar. You'll just have more undissolved sugar sludge at the bottom of the tank. Annoying for sure, but not damaging the engine.