A California man was charged with having child pornography - after burglars found the images while robbing his house and called police.

The burglars, a 19-year-old and a juvenile, broke into a barn owned by Kraig Stockard, 54, of Delhi, Calif., and stole about 50 CDs they thought were blank, according to a statement from Deputy Tom MacKenzie of the Merced County Sheriff's Department.

When the thieves downloaded the discs, they discovered the child porn, the statement said. They went straight to police, despite knowing that they'd be admitting the burglary.

Police searched Stockard's property and seized three more computers and three laptops, along with several external hard drives, according to CNN. Police said more than 30 computer discs had child pornography on them.

Investigators said Stockard has been downloading child porn since 2004. He was booked for possession of child pornography and posted $25,000 bail.

The two burglary suspects who reported Stockard have not been arrested.