The call to abandon idol worship acts as a direct condition for receiving protection from punishment. The primary approach among commentators is that the warning against angering God through the work of human hands specifically targets the idols and statues that the people craft themselves.
When the people successfully avoid worshiping these false gods, a promise of safety immediately follows. God guarantees that He will not bring harm upon the people and will not hurt them. Remaining secure and free from disaster is a direct result of their choice to stay away from idolatrous practices.