(CNN) — A man with a loaded gun in a diaper bag shot himself and his daughter while changing his daughter’s diaper in a vehicle in Vestavia Hills, Alabama, police said.

CNN affiliates report the incident happened Saturday afternoon, either at or near a Chuck E. Cheese’s pizza parlor in the Birmingham suburb.

The father, who was not identified, was in the back seat of a vehicle changing the girl’s diaper, and the gun went off as he picked up or reached inside the bag, which was sitting on the floorboard, Vestavia Hills Police Department spokesman Capt. Johnny Evans said.

After the gun went off, the bullet traveled through the adult’s leg and then the child’s leg before lodging in the man’s chest, Evans said.

The child is going to be OK. Her father is in serious condition, he said.

CNN affiliate WBMA reported the shooting happened near Chuck E. Cheese’s, while another affiliate, WBRC, said it occurred in the parking lot of the child-themed pizza and gaming center.

John and Ashley Gerrard of Bessemer were at Chuck E. Cheese’s with their 2-year-old when the shooting happened, leaving them worried for their daughter’s safety, WBRC reported.

“You don’t expect anyone would bring a gun around where kids would be. It just doesn’t make any sense,” John Gerrard told the station.

Both WBMA and WBRC quoted police officials saying the shooting appeared accidental.