issue #19456: don't release an empty lock