2004-02-02 Hans Petter Jansson <hpj@ximian.com>
* libebook/e-contact.c (photo_getter): Return NULL if image length is
zero.
(photo_setter): Warn and don't set photo if image length is zero.
2004-02-02 Hans Petter Jansson <hpj@ximian.com>
+ * libebook/e-contact.c (photo_getter): Return NULL if image length is
+ zero.
+ (photo_setter): Warn and don't set photo if image length is zero.
+
+2004-02-02 Hans Petter Jansson <hpj@ximian.com>
+
* libebook/e-contact.c (photo_setter): Handle NULL.
(fn_setter): Handle NULL.
(n_setter): Handle NULL.
if (values && values->data) {
GString *s = values->data;
- EContactPhoto *photo = g_new (EContactPhoto, 1);
+ EContactPhoto *photo;
+ if (!s->len)
+ return NULL;
+
+ photo = g_new (EContactPhoto, 1);
photo->length = s->len;
photo->data = g_malloc (photo->length);
memcpy (photo->data, s->str, photo->length);
if (!photo)
return;
+ g_return_if_fail (photo->length > 0);
+
e_vcard_attribute_add_param_with_value (attr,
e_vcard_attribute_param_new (EVC_ENCODING),
"b");