Przeglądaj źródła

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

Michael Bromley 4 lat temu
rodzic
commit
3fcf5dc89d

+ 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,
         defaultVal: 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;
     }
 }