Browse Source

fix(core): Fix regression in accessing OrderLine.items when not defined

Michael Bromley 3 years ago
parent
commit
3fcf5dc89d
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/core/src/entity/order-line/order-line.entity.ts

+ 1 - 1
packages/core/src/entity/order-line/order-line.entity.ts

@@ -291,7 +291,7 @@ export class OrderLine extends VendureEntity implements HasCustomFields {
         prop: K,
         prop: K,
         defaultVal: OrderItem[K],
         defaultVal: OrderItem[K],
     ): OrderItem[K] {
     ): OrderItem[K] {
-        const items = this.activeItems.length ? this.activeItems : this.items;
+        const items = this.activeItems.length ? this.activeItems : this.items ?? [];
         return items.length ? items[0][prop] : defaultVal;
         return items.length ? items[0][prop] : defaultVal;
     }
     }
 }
 }