The violation of any statute or ordinance shall not establish negligence as a matter of law where the act or omission involved was required in order to comply with an order or proclamation of any military commander who is authorized to issue such orders or proclamations; nor when the act or omission involved is required in order to comply with any regulation, directive, or order of the Governor promulgated under the California Emergency Services Act. No person shall be prosecuted for a violation of any statute or ordinance when violation of such statute or ordinance is required in order to comply with an order or proclamation of any military commander who is authorized to issue such orders or proclamations; nor shall any person be prosecuted for a violation of any statute or ordinance when violation of such statute or ordinance is required in order to comply with any regulation, directive, or order of the Governor promulgated under the California Emergency Services Act. The provisions of this section shall apply to such acts or omissions whether occurring prior to or after the effective date of this section.
Ca. Civ. Code § 1714.6