test/testiconv.c
changeset 2142 ca80c942e69c
parent 1895 c121d94672cb
child 2143 e906da4414a3
--- a/test/testiconv.c	Tue Jul 03 09:55:29 2007 +0000
+++ b/test/testiconv.c	Wed Jul 04 07:08:16 2007 +0000
@@ -57,12 +57,16 @@
         for (i = 0; i < SDL_arraysize(formats); ++i) {
             test[0] = SDL_iconv_string(formats[i], "UCS-4", ucs4, len);
             test[1] = SDL_iconv_string("UCS-4", formats[i], test[0], len);
-            if (SDL_memcmp(test[1], ucs4, len) != 0) {
+            if (!test[1] || SDL_memcmp(test[1], ucs4, len) != 0) {
                 fprintf(stderr, "FAIL: %s\n", formats[i]);
                 ++errors;
             }
-            SDL_free(test[0]);
-            SDL_free(test[1]);
+            if(test[0]) {
+                SDL_free(test[0]);
+            }
+            if(test[1]) {
+                SDL_free(test[1]);
+            }
         }
         test[0] = SDL_iconv_string("UTF-8", "UCS-4", ucs4, len);
         SDL_free(ucs4);