]> code.delx.au - pulseaudio/blobdiff - src/pulse/proplist.c
device-restore: Various fixes for the protocol extension.
[pulseaudio] / src / pulse / proplist.c
index 8b5b65380557b7efc7fcb73d35491f8899292173..75445e06366c543a4bfef9271e155a0619c346ec 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <pulse/xmalloc.h>
 #include <pulse/utf8.h>
-#include <pulse/i18n.h>
 
 #include <pulsecore/hashmap.h>
 #include <pulsecore/strbuf.h>
@@ -251,7 +250,7 @@ int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nb
 
     pa_assert(p);
     pa_assert(key);
-    pa_assert(data);
+    pa_assert(data || nbytes == 0);
 
     if (!property_name_valid(key))
         return -1;
@@ -264,7 +263,8 @@ int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nb
         pa_xfree(prop->value);
 
     prop->value = pa_xmalloc(nbytes+1);
-    memcpy(prop->value, data, nbytes);
+    if (nbytes > 0)
+        memcpy(prop->value, data, nbytes);
     ((char*) prop->value)[nbytes] = 0;
     prop->nbytes = nbytes;