Penal Code 46.13 makes it an offense if a child under the age of 17 gains access to a "readily dischargeable firearm" (be sure to read the definitions!) and you didn't take steps to prevent it, but it is an affirmative defense if the child was engaged in lawful defense of people or property.
Sec.46.13.MAKING A FIREARM ACCESSIBLE TO A CHILD. (a)In this section:
(1)"Child" means a person younger than 17 years of age.
(2)"Readily dischargeable firearm" means a firearm that is loaded with ammunition, whether or not a round is in the chamber.
(3)"Secure" means to take steps that a reasonable person would take to prevent the access to a readily dischargeable firearm by a child, including but not limited to placing a firearm in a locked container or temporarily rendering the firearm inoperable by a trigger lock or other means.
(b)A person commits an offense if a child gains access to a readily dischargeable firearm and the person with criminal negligence:
(1)failed to secure the firearm; or
(2)left the firearm in a place to which the person knew or should have known the child would gain access.
(c)It is an affirmative defense to prosecution under this section that the child's access to the firearm:
(1)was supervised by a person older than 18 years of age and was for hunting, sporting, or other lawful purposes;
(2)consisted of lawful defense by the child of people or property;
(3)was gained by entering property in violation of this code; or
(4)occurred during a time when the actor was engaged in an agricultural enterprise.
(d)Except as provided by Subsection (e), an offense under this section is a Class C misdemeanor.
(e)An offense under this section is a Class A misdemeanor if the child discharges the firearm and causes death or serious bodily injury to himself or another person.
(f)A peace officer or other person may not arrest the actor before the seventh day after the date on which the offense is committed if:
(1)the actor is a member of the family, as defined by Section 71.003, Family Code, of the child who discharged the firearm; and
(2)the child in discharging the firearm caused the death of or serious injury to the child.
(g)A dealer of firearms shall post in a conspicuous position on the premises where the dealer conducts business a sign that contains the following warning in block letters not less than one inch in height:
"IT IS UNLAWFUL TO STORE, TRANSPORT, OR ABANDON AN UNSECURED FIREARM IN A PLACE WHERE CHILDREN ARE LIKELY TO BE AND CAN OBTAIN ACCESS TO THE FIREARM."