There is no (nor could there be) a law that would prevent global nuclear war. Should a nation with nuclear weapons decide that it wanted to start launching nukes, then those nukes are getting launched regardless of any relevant legal issues.
International law is, unfortunately, more about re-enforcing the hierarchy of power between nations. They are tools used by the dominant nations to keep the "status quo." When a situation arises where following those laws conflicts with their own national interests, those laws will be reinterpreted, modified, or outright ignored.
That being said, global nuclear war itself is generally the opposite of "status quo," so it is unlikely that these dominant nations would purposefully take action leading to it. A rogue actor that manages to detonate a nuclear weapon is unlikely to initiate a global nuclear conflict, simply because it is not in any nation's best interest.