Skip to content

A free open source IT asset/license management system

Don’t 500 if the 1D barcode doesn’t match the format requested - log an error instead

snipe45898deb1a19
diff --git a/app/Models/Labels/Label.php b/app/Models/Labels/Label.php
index ff759ac544..9b48a7e730 100644
--- a/app/Models/Labels/Label.php
+++ b/app/Models/Labels/Label.php
@@ -370,7 +370,11 @@ abstract class Label
*/
public final function write1DBarcode(TCPDF $pdf, $value, $type, $x, $y, $width, $height) {
if (empty($value)) return;
- $pdf->write1DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]);
+ try {
+ $pdf->write1DBarcode($value, $type, $x, $y, $width, $height, null, ['stretch'=>true]);
+ } catch (\Exception $e) {
+ \Log::error('The 1D barcode ' . $value . ' is not compliant with the barcode type '. $type);
+ }
}
/**