Skip to content

Commit 441fdaa

Browse files
authored
Merge pull request #16278 from marcusmoore/bug/sc-27234
Added better error handling around rendering barcodes
2 parents 4d25e8f + 759c8c8 commit 441fdaa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/Http/Controllers/Assets/AssetsController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use Illuminate\Contracts\View\View;
3131
use Illuminate\Http\RedirectResponse;
3232
use Symfony\Component\HttpFoundation\BinaryFileResponse;
33+
use TypeError;
3334

3435
/**
3536
* This class controls all actions related to assets for
@@ -590,7 +591,7 @@ public function getBarCode($assetId = null)
590591
file_put_contents($barcode_file, $barcode_obj->getPngData());
591592

592593
return response($barcode_obj->getPngData())->header('Content-type', 'image/png');
593-
} catch (\Exception $e) {
594+
} catch (\Exception|TypeError $e) {
594595
Log::debug('The barcode format is invalid.');
595596

596597
return response(file_get_contents(public_path('uploads/barcodes/invalid_barcode.gif')))->header('Content-type', 'image/gif');

0 commit comments

Comments
 (0)