Author: leo
Date: Wed Nov  9 12:18:56 2005
New Revision: 9868

Modified:
   trunk/encodings/utf16.c
Log:
fix unguarded usage of UChar - and do it right ;-)

Modified: trunk/encodings/utf16.c
==============================================================================
--- trunk/encodings/utf16.c     (original)
+++ trunk/encodings/utf16.c     Wed Nov  9 12:18:56 2005
@@ -108,9 +108,10 @@ copy_to_encoding(Interp *interpreter, ST
     dest->strlen   = src_len;
     dest->charset  = Parrot_unicode_charset_ptr;
     dest->encoding = Parrot_utf16_encoding_ptr;
-    Parrot_allocate_string(interpreter, dest, 0);
-    if (!src_len)
+    if (!src_len) {
+        Parrot_allocate_string(interpreter, dest, 0);
         return dest;
+    }
 #if PARROT_HAS_ICU
     Parrot_allocate_string(interpreter, dest, sizeof(UChar) * src_len);
     err = U_ZERO_ERROR;

Reply via email to