Center to origin

 From:  nameless
2409.9 
I am trying to run this script with a shortcut and the selected object disappears.

When I run it via the script menu at the bottom, the object is centered as expected. Any ideas what could be wrong?

edit: I remember it was working fine at some point- no idea what changed

EDITED: 27 Feb 2022 by NAMELESS