altosuilib: Fix crash when initializing site map cache
[fw/altos] / altosuilib / AltosSiteMapCache.java
index 7f436ef0729b595da087f7c706098dd854fc4eca..51778ce1301d404ed1c70b444c91afab9603e032 100644 (file)
@@ -158,7 +158,7 @@ public class AltosSiteMapCache {
                        for (int i = 0; i < cache_size; i++) {
                                if (i < new_size)
                                        new_images[i] = images[i];
                        for (int i = 0; i < cache_size; i++) {
                                if (i < new_size)
                                        new_images[i] = images[i];
-                               else
+                               else if (images[i] != null)
                                        images[i].flush();
                        }
                        images = new_images;
                                        images[i].flush();
                        }
                        images = new_images;
@@ -176,6 +176,7 @@ public class AltosSiteMapCache {
                return new Point (x, y);
        }
 
                return new Point (x, y);
        }
 
+/*
        private static void dump_cache() {
                int     min_x = 1000, max_x = -1000, min_y = 1000, max_y = -1000;
 
        private static void dump_cache() {
                int     min_x = 1000, max_x = -1000, min_y = 1000, max_y = -1000;
 
@@ -208,6 +209,7 @@ public class AltosSiteMapCache {
                        System.out.printf("\n");
                }
        }
                        System.out.printf("\n");
                }
        }
+*/
 
        public static AltosSiteMapImage get_image(AltosSiteMapTile tile, File file, int width, int height) {
                int             oldest = -1;
 
        public static AltosSiteMapImage get_image(AltosSiteMapTile tile, File file, int width, int height) {
                int             oldest = -1;