The penalties of this chapter shall not apply as to any building which, at the time of issuance of a permit for the construction thereof was in compliance with the laws then existing, if its use is not in violation of the laws for the protection of public health.
Ca. Health and Saf. Code § 9677