Buggy code:
int textShadow = 0 ; int textWrap = 0 ; boolean bold = false ; int shieldRes = 0 ; int textOrder = 20 ; public void fillProperties ( RenderingRuleSearchRequest render , float centerX , float centerY ) { } } private static class IconDrawInfo { float x = 0 ; float y = 0 ; int resId ; } static class RenderingContext { public boolean interrupted = false ; public boolean nightMode = false ; public boolean highResMode = false ; public float mapTextSize = 1 ; List < OsmandRenderer . TextDrawInfo > textToDraw = new ArrayList < OsmandRenderer . TextDrawInfo > ( ) ; List < OsmandRenderer . IconDrawInfo > iconsToDraw = new ArrayList < OsmandRenderer . IconDrawInfo > ( ) ; float leftX ; float topY ; int width ; int height ; int zoom ; float rotate ; float tileDivisor ; int pointCount = 0 ; int pointInsideCount = 0 ; int visible = 0 ; int allObjects = 0 ; PointF tempPoint = new PointF ( ) ; float cosRotateTileSize ; float sinRotateTileSize ; String renderingDebugInfo ; } public OsmandRenderer ( Context context ) { } public PathEffect getDashEffect ( String dashes ) { } public Shader getShader ( int resId ) { } private void put ( TIntObjectHashMap < TIntArrayList > map , int k , int v , int init ) { } public Bitmap generateNewBitmap ( OsmandRenderer . RenderingContext rc , List < BinaryMapDataObject > objects , Bitmap bmp , boolean useEnglishNames , RenderingRuleSearchRequest render , List < IMapDownloaderCallback > notifyList , int defaultColor ) { long now = System . currentTimeMillis ( ) ; Canvas cv = new Canvas ( bmp ) ; if ( defaultColor != 0 ) { paintFillEmpty . setColor ( defaultColor ) ; } cv . drawRect ( 0 , 0 , bmp . getWidth ( ) , bmp . getHeight ( ) , paintFillEmpty ) ; int sz = objects . size ( ) ; int init = sz // 4 ; TIntObjectHashMap < TIntArrayList > orderMap = new TIntObjectHashMap < TIntArrayList > ( ) ; if ( render != null ) { for ( int i = 0 ; i < sz ; i ++ ) { BinaryMapDataObject o = objects . get ( i ) ; int sh = i << 8 ; if ( o instanceof MultyPolygon ) { int layer = ( ( MultyPolygon ) ( o ) ) . getLayer ( ) ; render . setInitialTagValueZoom ( ( ( MultyPolygon ) ( o ) ) . getTag ( ) , ( ( MultyPolygon ) ( o ) ) . getValue ( ) , rc . zoom ) ; render . setIntFilter ( render . ALL . R_LAYER , layer ) ; render . setIntFilter ( render . ALL . R_ORDER_TYPE , POLYGON_TYPE ) ; if ( render . search ( ORDER_RULES ) ) { put ( orderMap , render . getIntPropertyValue ( render . ALL . R_ORDER ) , sh , init ) ; } } else { for ( int j = 0 ; j < ( o . getTypes ( ) . length ) ; j ++ ) { int wholeType = o . getTypes ( ) [ j ] ; int mask = wholeType & 3 ; int layer = 0 ; if ( mask != 1 ) { layer = MapRenderingTypes . getNegativeWayLayer ( wholeType ) ; } TagValuePair pair = o . getMapIndex ( ) . decodeType ( MapRenderingTypes . getMainObjectType ( wholeType ) , MapRenderingTypes . getObjectSubType ( wholeType ) ) ; if ( pair != null ) { render . setInitialTagValueZoom ( pair . tag , pair . value , rc . zoom ) ; render . setIntFilter ( render . ALL . R_LAYER , layer ) ; render . setIntFilter ( render . ALL . R_ORDER_TYPE , mask ) ; if ( render . search ( ORDER_RULES ) ) { <START_BUG> put ( orderMap , render . getIntPropertyValue ( render . ALL . R_ORDER ) , sh , init ) ; <END_BUG> } } } } if ( rc . interrupted ) { return null ; } } } if ( ( ( ( objects != null ) && ( ! ( objects . isEmpty ( ) ) ) ) && ( ( rc . width ) > 0 ) ) && ( ( rc . height ) > 0 ) ) { rc . tileDivisor = ( ( int ) ( 1 << ( 31 - ( rc . zoom ) ) ) ) ; rc . cosRotateTileSize = ( FloatMath . cos ( ( ( float ) ( Math . toRadians ( rc . rotate ) ) ) ) ) * ( OsmandRenderer . TILE_SIZE ) ; rc . sinRotateTileSize = ( FloatMath . sin ( ( ( float ) ( Math . toRadians ( rc . rotate ) ) ) ) ) * ( OsmandRenderer . TILE_SIZE ) ; int [ ] keys = orderMap . keys ( ) ; Arrays . sort ( keys ) ; int objCount = 0 ; for ( int k = 0 ; k < ( keys . length ) ; k ++ ) { TIntArrayList list = orderMap . get ( keys [ k ] ) ; for ( int j = 0 ; j < ( list . size ( ) ) ; j ++ ) { int i = list . get ( j ) ; int ind = i > > 8 ; int l = i & 255 ; BinaryMapDataObject obj = objects . get ( ind ) ; drawObj ( obj , render , cv , rc , l , ( l == 0 ) ) ; objCount ++ ; } if ( objCount > 25 ) { notifyListeners ( notifyList ) ; objCount = 0 ; } if ( rc . interrupted ) { return null ; } } notifyListeners ( notifyList ) ;

Fix:
put ( orderMap , render . getIntPropertyValue ( render . ALL . R_ORDER ) , ( sh + j ) , init ) ;