File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
source/matplot/axes_objects Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1630,6 +1630,11 @@ namespace matplot {
1630
1630
std::get<2 >(cur_child) = j;
1631
1631
std::get<1 >(cur).emplace_back (cur_child);
1632
1632
}
1633
+ // check for bounds before accessing value and
1634
+ // break while loop if fails.
1635
+ if (j + 1 >= filled_lines_[i].first .size ()) {
1636
+ break ;
1637
+ }
1633
1638
// Two nans in a row indicate a new parent
1634
1639
bool only_one_nan =
1635
1640
std::isfinite (filled_lines_[i].first [j + 1 ]);
@@ -1645,7 +1650,8 @@ namespace matplot {
1645
1650
line_segments_.emplace_back (cur);
1646
1651
std::get<1 >(cur).clear ();
1647
1652
++j;
1648
- while (!std::isfinite (filled_lines_[i].first [j])) {
1653
+ while (j < filled_lines_[i].first .size () &&
1654
+ !std::isfinite (filled_lines_[i].first [j])) {
1649
1655
++j;
1650
1656
}
1651
1657
// start new parent
You can’t perform that action at this time.
0 commit comments