[libegg] EggSpreadTable: Avoid a division by null if there are no lines.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libegg] EggSpreadTable: Avoid a division by null if there are no lines.
- Date: Wed, 3 Dec 2014 08:50:44 +0000 (UTC)
commit 54489b5c3ba32c517a932f6b4402c06b599a29d1
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Dec 3 09:45:26 2014 +0100
EggSpreadTable: Avoid a division by null if there are no lines.
Found by Coverity Scan (while scanning Glom).
libegg/spreadtable/eggspreadtablednd.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/libegg/spreadtable/eggspreadtablednd.c b/libegg/spreadtable/eggspreadtablednd.c
index e342880..0b7e94b 100644
--- a/libegg/spreadtable/eggspreadtablednd.c
+++ b/libegg/spreadtable/eggspreadtablednd.c
@@ -490,7 +490,12 @@ get_spread_table_dimensions (EggSpreadTableDnd *spread_table,
*item_spacing = local_item_spacing;
if (line_width)
- *line_width = (local_full_size - (local_spacing * (lines -1))) / lines;
+ {
+ if (lines == 0)
+ *line_width = 0;
+ else
+ *line_width = (local_full_size - (local_spacing * (lines -1))) / lines;
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]