diff --git a/app/src/Model/Venta/Unidad.php b/app/src/Model/Venta/Unidad.php index 176e299..461880b 100644 --- a/app/src/Model/Venta/Unidad.php +++ b/app/src/Model/Venta/Unidad.php @@ -20,7 +20,7 @@ class Unidad extends Ideal\Model public function precio(DateTimeInterface $dateTime): Precio { - if ($dateTime > $this->currentPrecio->current->fecha) { + if ($this->currentPrecio !== null and $dateTime > $this->currentPrecio->current->fecha) { return $this->currentPrecio; } $precio = array_reduce(array_filter($this->precios, function(Precio $precio) use ($dateTime) {