diff --git simworld.cc simworld.cc index 3176470428..f6d7388380 100644 --- simworld.cc +++ simworld.cc @@ -6026,7 +6026,7 @@ void karte_t::calc_climate_map_region( sint16 xtop, sint16 ytop, sint16 xbottom, const sint16 max_patchsize_x = clamp( 5, xbottom / 24, 256 ); const sint16 max_patchsize_y = clamp( 5, ybottom / 24, 256 ); - minivec_tpl allowed( 8 ); + minivec_tpl allowed( MAX_CLIMATES ); { // find the next climateless tile for( sint16 y = ytop; y < ybottom; y++ ) { @@ -6040,7 +6040,7 @@ void karte_t::calc_climate_map_region( sint16 xtop, sint16 ytop, sint16 xbottom, allowed.append(cl); } } - climate cl = (climate)allowed[ simrand( allowed.get_count() - 1 ) ]; + climate cl = (!allowed.empty()) ? (climate)allowed[ simrand( allowed.get_count() - 1 ) ] : desert_climate; // now we do an ellipse with size wx and wy around the starting point const sint32 wx = simrand( max_patchsize_x ); const sint32 wy = simrand( max_patchsize_y );