LP#1942220: fix glitch in direct charges deletion testing
authorGalen Charlton <gmc@equinoxOLI.org>
Tue, 14 Dec 2021 16:09:29 +0000 (11:09 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Tue, 14 Dec 2021 16:09:29 +0000 (11:09 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/acq/po/charges.component.ts

index 21464f9..d38f54b 100644 (file)
@@ -122,12 +122,12 @@ export class PoChargesComponent implements OnInit, OnDestroy {
         if (debit && debit.encumbrance() === 'f') {
             return false; // if it's expended, we can't just delete it
         }
-        if (debit.invoice_entry()) {
+        if (debit && debit.invoice_entry()) {
             return false; // we shouldn't actually be a po_item that is
                           // linked to an invoice_entry, but if we are,
                           // do NOT touch
         }
-        if (debit.invoice_items() && debit.invoice_items().length) {
+        if (debit && debit.invoice_items() && debit.invoice_items().length) {
             return false; // we're linked to an invoice item, so the disposition of the
                           // invoice entry should govern things
         }