summaryrefslogtreecommitdiff
path: root/src/generators.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/generators.c')
-rw-r--r--src/generators.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/generators.c b/src/generators.c
index 8a2053a..a8151c1 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -63,6 +63,8 @@ generate_image (TGallerySetup *setup,
*thumb = NULL;
*img_w = 0;
*img_h = 0;
+ thumb_src_full = NULL;
+ img_src_full = NULL;
if (items->type == GALLERY_TYPE_INDEX) {
if (item->thumbnail == NULL || strlen (item->thumbnail) == 0)
@@ -93,6 +95,7 @@ generate_image (TGallerySetup *setup,
new_h = *img_h;
/* Generate thumbnail */
+ g_assert (thumb_src_full != NULL);
get_image_sizes (thumb_src_full, &thumb_w, &thumb_h);
s1 = g_path_get_dirname (dst);
thumb_dst = g_strconcat (s1, "/", THUMBNAIL_DIR, "/", *thumb, NULL);
@@ -150,6 +153,7 @@ generate_image (TGallerySetup *setup,
}
}
+ g_assert (img_src_full != NULL);
if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq, FALSE))
fprintf (stderr, "write_html_index: error resizing big image %s\n", img_src_full);
else
@@ -185,8 +189,10 @@ generate_image (TGallerySetup *setup,
}
}
}
- g_free (img_src_full);
- g_free (thumb_src_full);
+ if (img_src_full)
+ g_free (img_src_full);
+ if (thumb_src_full)
+ g_free (thumb_src_full);
}
@@ -695,6 +701,7 @@ write_html_image (TGallerySetup *setup,
/* Navigation bar */
s1 = g_strdup (imgname);
parent = parent_items;
+ old_parent_item_index = -1;
level = 0;
while (parent) {
s3 = make_string ("../", level);
@@ -965,6 +972,9 @@ build_tree (TGallerySetup *setup,
else
if (items->type == GALLERY_TYPE_ALBUM)
template = g_strconcat ("/", setup->template_album, NULL);
+ else
+ /* default to album */
+ template = g_strconcat ("/", setup->template_album, NULL);
if (setup->verbose) printf ("Writing 'index.html' ...\n");
s1 = g_strconcat (setup->real_templates_dir, template, NULL);