Skip to content

Commit

Permalink
Add safeguard on reading constraints when old_screen_size == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesYang007 committed Jun 13, 2024
1 parent ca3124b commit 17971e1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions adelie/src/include/adelie_core/state/state_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ void update_screen_derived_base(
/* update screen_is_active */
screen_is_active.resize(screen_set.size(), false);

/* update screen_dual-begins */
const auto last_constraint = constraints[screen_set[old_screen_size-1]];
/* update screen_dual_begins */
const auto last_constraint = (
(old_screen_size == 0) ?
nullptr : constraints[screen_set[old_screen_size-1]]
);
size_t screen_dual_value_size = (
(old_screen_size == 0) ?
0 : (screen_dual_begins.back() + (
Expand Down

0 comments on commit 17971e1

Please sign in to comment.