Skip to content

A free open source IT asset/license management system

Catch TypeError when rendering 1d barcode

Marcus Moorebed1055c4ef1
diff --git a/app/Models/Labels/Label.php b/app/Models/Labels/Label.php
index 9b48a7e730..69f67f6760 100644
--- a/app/Models/Labels/Label.php
+++ b/app/Models/Labels/Label.php
@@ -7,6 +7,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
use TCPDF;
use TCPDF_STATIC;
+use TypeError;
/**
* Model for Labels.
@@ -372,7 +373,7 @@ abstract class Label
if (empty($value)) return;
try {
$pdf->write1DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]);
- } catch (\Exception $e) {
+ } catch (\Exception|TypeError $e) {
\Log::error('The 1D barcode ' . $value . ' is not compliant with the barcode type '. $type);
}
}