From 022167f11ed25bd1d93360bd398d19c541dd82d4 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 16 Jan 2018 11:18:34 +0000 Subject: [PATCH] lazbarcodes: Fix divide-by-zero error. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6138 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/lazbarcodes/src/urender.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/lazbarcodes/src/urender.pas b/components/lazbarcodes/src/urender.pas index 768e63ddc..a1d1cec4b 100644 --- a/components/lazbarcodes/src/urender.pas +++ b/components/lazbarcodes/src/urender.pas @@ -214,7 +214,10 @@ begin end; if large_bar_count = 0 then begin - required_aspect := width / height; + if height = 0 then + required_aspect := 1.0 + else + required_aspect := width / height; symbol_aspect := (total_symbol_width_x + (2 * xoffset)) / (preset_height + (2 * yoffset) + text_offset + text_height); symbol^.height := trunc(preset_height); if required_aspect > symbol_aspect then