Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
fix crash when using an empty tuple in a math operation, fixes #92
Browse files Browse the repository at this point in the history
  • Loading branch information
cpdt committed Oct 13, 2018
1 parent 5b8f8c8 commit 1ce7496
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/src/pass/lower_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,11 @@ impl<'a> AstLower<'a> {
.collect()
} else {
// only one side is a tuple
let iter_count = left_items.len().max(right_items.len());
let iter_count = if left_items.len() == 1 {
right_items.len()
} else {
left_items.len()
};
(0..iter_count)
.map(|index| {
let left_index = if index >= left_items.len() { 0 } else { index };
Expand Down

0 comments on commit 1ce7496

Please sign in to comment.