]> Pileus Git - grits/commitdiff
Fix crash when unable to cache http files
authorAndy Spencer <andy753421@gmail.com>
Tue, 11 Oct 2011 06:28:27 +0000 (06:28 +0000)
committerAndy Spencer <andy753421@gmail.com>
Tue, 11 Oct 2011 06:29:24 +0000 (06:29 +0000)
src/data/grits-http.c
src/plugins/elev.c

index 60753983c37d88be8754396d7a169a1121e51ba8..3b0c83ebd6c9fa8774db46cd63b009043a87fc92 100644 (file)
@@ -164,6 +164,10 @@ gchar *grits_http_fetch(GritsHttp *http, const gchar *uri, const char *local,
                if (!g_file_test(path, G_FILE_TEST_EXISTS))
                        part = g_strdup_printf("%s.part", path);
                FILE *fp = fopen_p(part, "ab");
                if (!g_file_test(path, G_FILE_TEST_EXISTS))
                        part = g_strdup_printf("%s.part", path);
                FILE *fp = fopen_p(part, "ab");
+               if (!fp) {
+                       g_warning("GritsHttp: fetch - error opening %s", path);
+                       return NULL;
+               }
                fseek(fp, 0, SEEK_END); // "a" is broken on Windows, twice
 
                /* Make temp data */
                fseek(fp, 0, SEEK_END); // "a" is broken on Windows, twice
 
                /* Make temp data */
index 078fb9108738dd7a57be8dc85da838b1be0b1fa5..6f03e6981ed58ed8ecd60f30acf2224801799225 100644 (file)
@@ -204,6 +204,7 @@ static void _load_tile(GritsTile *tile, gpointer _elev)
 
        struct _LoadTileData *load = g_new0(struct _LoadTileData, 1);
        load->path = grits_wms_fetch(elev->wms, tile, GRITS_ONCE, NULL, NULL);
 
        struct _LoadTileData *load = g_new0(struct _LoadTileData, 1);
        load->path = grits_wms_fetch(elev->wms, tile, GRITS_ONCE, NULL, NULL);
+       if (!load->path) return; // Canceled/error
        g_debug("GritsPluginElev: _load_tile: %s", load->path);
        load->elev = elev;
        load->tile = tile;
        g_debug("GritsPluginElev: _load_tile: %s", load->path);
        load->elev = elev;
        load->tile = tile;