In some jurisdictions (I can only speak for Germany with some authority) if you've made a serious effort to get legal advice on a complicated topic and the legal advice was wrong this will (probably) mean that you're not guilty of a crime caused by the bad legal advice. Civil liability is a different topic obviously.
(But the "probably" is there for a reason: it really does depend on the specific topic at hand and whether you actually tried hard enough to comply with the law)