When you delete an order that holds a registered payment, it causes an error. This is because the process goes as:
- order entity is deleted
- uc_payment_uc_order_delete() is called (hook_ENTITY_ID_delete)
- uc_payment_receipt entities are deleted
- uc_payment_uc_payment_receipt_delete() is called (hook_ENTITY_ID_delete)
- uc_payment_uc_payment_receipt_delete() depends on the order entity to be available (but it is deleted)
I've made a patch to check if the $order is available or not in uc_payment_uc_payment_receipt_delete() before trying to log a message on the order.
Another way to go would be to change uc_payment_uc_order_delete() to uc_payment_uc_order_predelete() so that the order object is available.