From 65997bed1674c7c507518af46b88b4ab15a8b75f Mon Sep 17 00:00:00 2001 From: Noah Metzger Date: Wed, 1 Aug 2018 15:54:50 +0200 Subject: [PATCH] Fix issue detected by Coverity Scan CID: 1340285 (Division or modulo by zero) Signed-off-by: Noah Metzger --- src/textord/colfind.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/textord/colfind.cpp b/src/textord/colfind.cpp index d7b27bee..c8e6d0bf 100644 --- a/src/textord/colfind.cpp +++ b/src/textord/colfind.cpp @@ -926,7 +926,8 @@ void ColumnFinder::ComputeMeanColumnGap(bool any_multi_column) { &gap_samples); } mean_column_gap_ = any_multi_column && gap_samples > 0 - ? total_gap / gap_samples : total_width / width_samples; + ? total_gap / gap_samples : width_samples > 0 + ? total_width / width_samples : 0; } //////// Functions that manipulate ColPartitions in the part_grid_ /////