Auto merge of #18243 - DominoTree:18224, r=stshine

[18224] Check if line_count is zero to calculate space around line

<!-- Please describe your changes on the following line: -->
Check line_count before attempting to calculate space around line

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #18224 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because changes are minimal and the error was triggered by a test

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18243)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-26 17:07:28 -05:00 committed by GitHub
commit 163f29ff63

View file

@ -711,14 +711,18 @@ impl FlexFlow {
line_interval = match line_align {
align_content::T::space_between => {
if line_count == 1 {
if line_count <= 1 {
Au(0)
} else {
free_space / (line_count - 1)
}
}
align_content::T::space_around => {
free_space / line_count
if line_count == 0 {
Au(0)
} else {
free_space / line_count
}
}
_ => Au(0),
};