From 11e924cdeeb8330ff33e69c77eda962bd15d4be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano?= Date: Tue, 1 Jan 2013 20:55:43 +0100 Subject: [PATCH] better handling of empty comments --- opustags.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opustags.c b/opustags.c index 2d74e7d..62fd4e5 100644 --- a/opustags.c +++ b/opustags.c @@ -113,6 +113,8 @@ void delete_tags(opus_tags *tags, const char *field){ } int add_tags(opus_tags *tags, const char **tags_to_add, uint32_t count){ + if(count == 0) + return 0; uint32_t *lengths = realloc(tags->lengths, (tags->count + count) * sizeof(uint32_t)); const char **comment = realloc(tags->comment, (tags->count + count) * sizeof(char*)); if(lengths == NULL || comment == NULL) @@ -129,6 +131,8 @@ int add_tags(opus_tags *tags, const char **tags_to_add, uint32_t count){ } void print_tags(opus_tags *tags){ + if(tags->count == 0) + puts("no tags"); int i; for(i=0; icount; i++){ fwrite(tags->comment[i], 1, tags->lengths[i], stdout);