Make sure the columns and rows can never be 0

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-08-18 18:13:16 +01:00
parent 5645141f93
commit 0cb76a049a

View file

@ -62,6 +62,16 @@ class DefaultLabel extends RectangleSheet
$this->columns = ($usableWidth + $this->labelSpacingH) / ($this->labelWidth + $this->labelSpacingH);
$this->rows = ($usableHeight + $this->labelSpacingV) / ($this->labelHeight + $this->labelSpacingV);
// Make sure the columns and rows are never zero, since that scenario should never happen
if ($this->columns == 0) {
$this->columns = 1;
}
if ($this->rows == 0) {
$this->rows = 1;
}
}
public function getUnit() { return 'in'; }