connection: Don't call memcpy with null pointer.
[profile/ivi/wayland.git] / src / connection.c
index fdc9309..f2ef230 100644 (file)
@@ -517,12 +517,12 @@ wl_closure_vmarshal(struct wl_object *sender,
                                goto err;
                        *p++ = length;
 
-                       if (length > 0)
+                       if (length > 0) {
+                               memcpy(p, s, length);
                                *sp = (const char *) p;
-                       else
+                       else
                                *sp = NULL;
 
-                       memcpy(p, s, length);
                        memset((char *) p + length, 0, aligned - length);
                        p += aligned / sizeof *p;
                        break;