I always feel it’s such a horrible deux ex machima. As a writer, if you want the villain to die have the hero bear the responsibility of the act, don’t just try to morally whitewash it by engineering the circumstances.
Also obligatory: Han shot first!