Revert "Bug 740471 -  Applying payment to invoice Segmentation fault"

This reverts commit a6d7184d830d8a8bc0c339d012ac17c249a40994.
The patch had no effect on the bug at all and needlessly clutters the code.