Skip to content

Commit

Permalink
Merge pull request #79077 from inogenous/segfault-search-no-hits
Browse files Browse the repository at this point in the history
Prevent segfault when search gives no hits
  • Loading branch information
Maleclypse authored Jan 12, 2025
2 parents c8fcb20 + 1e39a76 commit dca8e06
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/newcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2537,7 +2537,7 @@ void set_profession( tab_manager &tabs, avatar &u, pool_type pool )

//Draw options
calcStartPos( iStartPos, cur_id, iContentHeight, profs_length );
const int end_pos = iStartPos + std::min( iContentHeight, profs_length );
const int end_pos = iStartPos + std::min( { iContentHeight, profs_length, sorted_profs.size() } );
std::string cur_prof_notes;
for( int i = iStartPos; i < end_pos; i++ ) {
nc_color col;
Expand Down Expand Up @@ -2892,7 +2892,7 @@ void set_hobbies( tab_manager &tabs, avatar &u, pool_type pool )

//Draw options
calcStartPos( iStartPos, cur_id, iContentHeight, hobbies_length );
const int end_pos = iStartPos + std::min( iContentHeight, hobbies_length );
const int end_pos = iStartPos + std::min( { iContentHeight, hobbies_length, sorted_hobbies.size() } );
std::string cur_hob_notes;
for( int i = iStartPos; i < end_pos; i++ ) {
nc_color col;
Expand Down Expand Up @@ -3606,7 +3606,7 @@ void set_scenario( tab_manager &tabs, avatar &u, pool_type pool )

//Draw options
calcStartPos( iStartPos, cur_id, iContentHeight, scens_length );
const int end_pos = iStartPos + std::min( iContentHeight, scens_length );
const int end_pos = iStartPos + std::min( { iContentHeight, scens_length, sorted_scens.size() } );
std::string current_scenario_notes;
for( int i = iStartPos; i < end_pos; i++ ) {
nc_color col;
Expand Down

0 comments on commit dca8e06

Please sign in to comment.