A Chicago police officer accidentally shot himself in the leg on Wednesday when he went to get his firearm from from the weapons room at a courthouse in the city.

The police officer’s gun accidentally discharged when he went to go get the gun during an evacuation of the courthouse, according to The Chicago Tribune. The evacuation was because a smoke detector alarm went off in the courthouse’s law library.

The gun discharged when the police officer was taking the gun from a locker. The bullet hit the officer in the upper leg. His injury was non-life threatening.