aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-08-24 05:08:41 -0600
committerbors-servo <metajack+bors@gmail.com>2015-08-24 05:08:41 -0600
commit524b02dbf7c2d8ef0d3a453124075f7718f7e458 (patch)
treec12e0f9b1491ac8529a82d2138055cb1efa3b18d
parentfa06a96f8a880a051ad4cad2489042547dd7f455 (diff)
parent4987e320d416efd91862dd7036e7bb642cc30598 (diff)
downloadservo-524b02dbf7c2d8ef0d3a453124075f7718f7e458.tar.gz
servo-524b02dbf7c2d8ef0d3a453124075f7718f7e458.zip
Auto merge of #7331 - paulrouget:issue-7316, r=SimonSapin
prevent division by 0 Fix #7316 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7331) <!-- Reviewable:end -->
-rw-r--r--components/layout/flex.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/components/layout/flex.rs b/components/layout/flex.rs
index 6861d6a62df..3c34aeaf728 100644
--- a/components/layout/flex.rs
+++ b/components/layout/flex.rs
@@ -212,8 +212,14 @@ impl FlexFlow {
debug!("inline_mode_assign_inline_sizes");
debug!("content_inline_size = {:?}", content_inline_size);
- debug!("child_count = {:?}", ImmutableFlowUtils::child_count(self as &Flow) as i32);
- let even_content_inline_size = content_inline_size / ImmutableFlowUtils::child_count(self as &Flow) as i32;
+
+ let child_count = ImmutableFlowUtils::child_count(self as &Flow) as i32;
+ debug!("child_count = {:?}", child_count);
+ if child_count == 0 {
+ return;
+ }
+
+ let even_content_inline_size = content_inline_size / child_count;
let inline_size = self.block_flow.base.block_container_inline_size;
let container_mode = self.block_flow.base.block_container_writing_mode;