Просмотр исходного кода

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

Michael Bromley 3 лет назад
Родитель
Сommit
32f2cd7842
1 измененных файлов с 1 добавлено и 1 удалено
  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,
         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;
     }
 }