File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -192,8 +192,9 @@ typedef struct HUD_CONFIG_TYPE {
192192 const HC_gauge_mappings& gauge_map = HC_gauge_mappings::get_instance ();
193193
194194 it = gauge_colors.find (gauge_map.get_string_id_from_numeric_id (type_it->second ));
195-
196- return it->second ;
195+ if (it != gauge_colors.end ()) {
196+ return it->second ;
197+ }
197198 }
198199
199200 // Still nothing.. return white
Original file line number Diff line number Diff line change @@ -127,24 +127,33 @@ class LabRenderer {
127127 void useNextTeamColorPreset () {
128128 if (!Team_Colors.empty ()) {
129129 auto color_itr = Team_Colors.find (currentTeamColor);
130+ auto penultimate = Team_Colors.end ();
131+ penultimate--;
130132
131- if (color_itr == Team_Colors.begin ()) {
132- color_itr = --Team_Colors.end ();
133- currentTeamColor = color_itr->first ;
133+ if (color_itr == Team_Colors.end ()) { // not found
134+ color_itr = Team_Colors.begin ();
135+ } else if (color_itr == penultimate) {
136+ color_itr = Team_Colors.begin ();
134137 } else {
135- --color_itr;
136- currentTeamColor = color_itr->first ;
138+ color_itr++;
137139 }
140+ currentTeamColor = color_itr->first ;
138141 }
139142 }
140143
141144 void usePreviousTeamColorPreset () {
142145 if (!Team_Colors.empty ()) {
143146 auto color_itr = Team_Colors.find (currentTeamColor);
147+ auto penultimate = Team_Colors.end ();
148+ penultimate--;
144149
145- ++color_itr;
146- if (color_itr == Team_Colors.end ())
150+ if (color_itr == Team_Colors.end ()) { // not found
147151 color_itr = Team_Colors.begin ();
152+ } else if (color_itr == Team_Colors.begin ()) {
153+ color_itr = penultimate;
154+ } else {
155+ color_itr--;
156+ }
148157 currentTeamColor = color_itr->first ;
149158 }
150159 }
Original file line number Diff line number Diff line change @@ -2203,7 +2203,7 @@ void debrief_draw_award_text()
22032203 curr_y = start_y;
22042204
22052205 // draw the strings
2206- for (i=0 ; i<Debrief_award_text_num_lines; i++) {
2206+ for (i=0 ; i<Debrief_award_text_num_lines && i < AWARD_TEXT_MAX_LINES ; i++) {
22072207 gr_get_string_size (&sw, NULL , Debrief_award_text[i]);
22082208 x = (Medal_bitmap < 0 ) ? (Debrief_award_text_coords[gr_screen.res ][0 ] + (field_width - sw) / 2 ) : Debrief_award_text_coords[gr_screen.res ][0 ];
22092209 if (i==AWARD_TEXT_MAX_LINES -1 ) x += 7 ; // hack because of the shape of the box
You can’t perform that action at this time.
0 commit comments