Why oh why make this complicated and make up your own rules?
What level and how serious? Technically, the player is supposed to leave the field to correct the equipment, but if it's simple at lower levels may be common to ignore that. Whether I make it leave the pitch instead of a pocket is going to depend on what it is--just use common sense.
Taken from another recent thread.