From c030a0cba9e058ca6f8377093bd72fb145e72138 Mon Sep 17 00:00:00 2001 From: gearhand Date: Mon, 20 May 2024 15:38:31 +0100 Subject: [PATCH] Fix mutation examine window crash (#71410) * Fix mutation examine window crash Fixes #71237 * Apply suggestions from code review Style fixes Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/mutation_ui.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mutation_ui.cpp b/src/mutation_ui.cpp index 0cb6c03d2c71a..d453fffc2e3b8 100644 --- a/src/mutation_ui.cpp +++ b/src/mutation_ui.cpp @@ -49,14 +49,14 @@ static const auto shortcut_desc = []( const std::string_view comment, const std: // needs extensive improvement -static trait_id GetTrait( const std::vector &active, - const std::vector &passive, - int cursor, mutation_tab_mode tab_mode ) +static std::optional GetTrait( const std::vector &active, + const std::vector &passive, + int cursor, mutation_tab_mode tab_mode ) { - trait_id mut_id; + std::optional mut_id; if( tab_mode == mutation_tab_mode::active ) { mut_id = active[cursor]; - } else { + } else if( tab_mode == mutation_tab_mode::passive ) { mut_id = passive[cursor]; } return mut_id;