From cd0f5d877890ddf5560efb457d9632683de75d46 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Thu, 23 Jul 2015 17:47:17 +0200 Subject: [PATCH] Do not risk a division by zero. --- src/gui/partwidgetbase.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/partwidgetbase.cpp b/src/gui/partwidgetbase.cpp index 8fe7244..05f5814 100644 --- a/src/gui/partwidgetbase.cpp +++ b/src/gui/partwidgetbase.cpp @@ -110,6 +110,9 @@ void PartWidgetBase::positionChildren(const QWidget* destWidget, const Partition foreach(const Partition * p, partitions) totalLength += p->length(); + if (totalLength < 1) + return; + // calculate unleveled width for each child and store it for (int i = 0; i < partitions.size(); i++) { childrenWidth.append(partitions[i]->length() * destWidgetWidth / totalLength);