altosuilib: Fix crash when initializing site map cache
[fw/altos] / altosuilib / AltosSiteMapCache.java
index c4316dabf4f5628cc26c3bddcbfcdab0b960e279..51778ce1301d404ed1c70b444c91afab9603e032 100644 (file)
@@ -48,7 +48,6 @@ public class AltosSiteMapCache {
        private static int fetch_one(File file, String url) {
                URL u;
 
-               System.out.printf("Loading URL %s\n", url);
                try {
                        u = new URL(url);
                } catch (java.net.MalformedURLException e) {
@@ -159,7 +158,7 @@ public class AltosSiteMapCache {
                        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;
@@ -177,6 +176,7 @@ public class AltosSiteMapCache {
                return new Point (x, y);
        }
 
+/*
        private static void dump_cache() {
                int     min_x = 1000, max_x = -1000, min_y = 1000, max_y = -1000;
 
@@ -209,6 +209,7 @@ public class AltosSiteMapCache {
                        System.out.printf("\n");
                }
        }
+*/
 
        public static AltosSiteMapImage get_image(AltosSiteMapTile tile, File file, int width, int height) {
                int             oldest = -1;