Avoid empty strings for yaz_iconv_open
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 10 Mar 2011 09:22:53 +0000 (10:22 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 10 Mar 2011 09:22:53 +0000 (10:22 +0100)
yaz_iconv_open apparently returns a non-null handle in case of
to=(null) and from="" .. Avoid we call it this way. This resulted
in bad records for Pazpar2 and was introduced in YAZ 4.1.5.

src/record_render.c

index 16351a2..ddfd391 100644 (file)
@@ -28,7 +28,7 @@ static yaz_iconv_t iconv_create_charset(const char *record_charset,
     char *from_set1 = 0;
     char *from_set2 = 0;
     char *to_set = 0;
     char *from_set1 = 0;
     char *from_set2 = 0;
     char *to_set = 0;
-    if (record_charset)
+    if (record_charset && *record_charset)
     {
         char *cp = charset_buf;
         
     {
         char *cp = charset_buf;