diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 11761333794..d3fbe41312c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4200,6 +4200,12 @@ class OrderLine extends CommonOrderLine $result = $this->db->query($sql); if ($result) { $objp = $this->db->fetch_object($result); + + if (!$objp) { + $this->error = 'OrderLine with id '. $rowid .' not found sql='.$sql; + return 0; + } + $this->rowid = $objp->rowid; $this->id = $objp->rowid; $this->fk_commande = $objp->fk_commande; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 69bfb73e867..183ee457c32 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5812,6 +5812,11 @@ class FactureLigne extends CommonInvoiceLine if ($result) { $objp = $this->db->fetch_object($result); + if (!$objp) { + $this->error = 'InvoiceLine with id '. $rowid .' not found sql='.$sql; + return 0; + } + $this->rowid = $objp->rowid; $this->id = $objp->rowid; $this->fk_facture = $objp->fk_facture;