]> git.tue.mpg.de Git - paraslash.git/commitdiff
Fix rename detection.
authorAndre Noll <maan@systemlinux.org>
Sat, 24 Nov 2007 13:19:21 +0000 (14:19 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 24 Nov 2007 13:19:21 +0000 (14:19 +0100)
If a file is renamed and re-added the old code would segfault because of
a NULL pointer dereference in save_chunk_table(). Fix is trivial.

aft.c

diff --git a/aft.c b/aft.c
index 7af50f9de8dfe25ffe70356edd0d5ceaabd79bf4..40c7e106b3b91bbee11b49d1d1c9b3ccf617b0ab 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1429,7 +1429,8 @@ static void save_audio_file_info(HASH_TYPE *hash, const char *path,
        pos += afhi_size;
        PARA_DEBUG_LOG("size: %zu, chunks start at %d\n", size, pos);
        write_u16(buf + AFTROW_CHUNKS_OFFSET_POS, pos);
-       save_chunk_table(afhi, buf + pos);
+       if (afhi)
+               save_chunk_table(afhi, buf + pos);
        PARA_DEBUG_LOG("last byte in buf: %p\n", buf + size - 1);
        obj->data = buf;
        obj->size = size;