Commit e6b09029 authored by W. Michael Petullo's avatar W. Michael Petullo
Browse files

Check if object attributes are NULL in add_entry_to_mlcl


Signed-off-by: W. Michael Petullo's avatarW. Michael Petullo <mike@flyn.org>
parent 1c2e473a
...@@ -558,8 +558,11 @@ add_entry_to_mlcl (gpointer id, ...@@ -558,8 +558,11 @@ add_entry_to_mlcl (gpointer id,
if (_dmap_share_client_requested (mb->bits, ITEM_NAME)) { if (_dmap_share_client_requested (mb->bits, ITEM_NAME)) {
gchar *title; gchar *title;
g_object_get (record, "title", &title, NULL); g_object_get (record, "title", &title, NULL);
dmap_structure_add (mlit, DMAP_CC_MINM, title); if (title) {
g_free (title); dmap_structure_add (mlit, DMAP_CC_MINM, title);
g_free (title);
} else
g_warning ("Title requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, PERSISTENT_ID)) if (_dmap_share_client_requested (mb->bits, PERSISTENT_ID))
dmap_structure_add (mlit, DMAP_CC_MPER, GPOINTER_TO_UINT (id)); dmap_structure_add (mlit, DMAP_CC_MPER, GPOINTER_TO_UINT (id));
...@@ -574,16 +577,22 @@ add_entry_to_mlcl (gpointer id, ...@@ -574,16 +577,22 @@ add_entry_to_mlcl (gpointer id,
if (_dmap_share_client_requested (mb->bits, SONG_ALBUM)) { if (_dmap_share_client_requested (mb->bits, SONG_ALBUM)) {
gchar *album; gchar *album;
g_object_get (record, "songalbum", &album, NULL); g_object_get (record, "songalbum", &album, NULL);
dmap_structure_add (mlit, DMAP_CC_ASAL, album); if (album) {
g_free (album); dmap_structure_add (mlit, DMAP_CC_ASAL, album);
g_free (album);
} else
g_warning ("Album requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, SONG_GROUPING)) if (_dmap_share_client_requested (mb->bits, SONG_GROUPING))
dmap_structure_add (mlit, DMAP_CC_AGRP, ""); dmap_structure_add (mlit, DMAP_CC_AGRP, "");
if (_dmap_share_client_requested (mb->bits, SONG_ARTIST)) { if (_dmap_share_client_requested (mb->bits, SONG_ARTIST)) {
gchar *artist; gchar *artist;
g_object_get (record, "songartist", &artist, NULL); g_object_get (record, "songartist", &artist, NULL);
dmap_structure_add (mlit, DMAP_CC_ASAR, artist); if (artist) {
g_free (artist); dmap_structure_add (mlit, DMAP_CC_ASAR, artist);
g_free (artist);
} else
g_warning ("Artist requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, SONG_BITRATE)) { if (_dmap_share_client_requested (mb->bits, SONG_BITRATE)) {
gint32 bitrate; gint32 bitrate;
...@@ -626,14 +635,20 @@ add_entry_to_mlcl (gpointer id, ...@@ -626,14 +635,20 @@ add_entry_to_mlcl (gpointer id,
format = g_strdup (transcode_format); format = g_strdup (transcode_format);
else else
g_object_get (record, "format", &format, NULL); g_object_get (record, "format", &format, NULL);
dmap_structure_add (mlit, DMAP_CC_ASFM, format); if (format) {
g_free (format); dmap_structure_add (mlit, DMAP_CC_ASFM, format);
g_free (format);
} else
g_warning ("Format requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, SONG_GENRE)) { if (_dmap_share_client_requested (mb->bits, SONG_GENRE)) {
gchar *genre; gchar *genre;
g_object_get (record, "songgenre", &genre, NULL); g_object_get (record, "songgenre", &genre, NULL);
dmap_structure_add (mlit, DMAP_CC_ASGN, genre); if (genre) {
g_free (genre); dmap_structure_add (mlit, DMAP_CC_ASGN, genre);
g_free (genre);
} else
g_warning ("Genre requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, SONG_DESCRIPTION)) if (_dmap_share_client_requested (mb->bits, SONG_DESCRIPTION))
dmap_structure_add (mlit, DMAP_CC_ASDT, ""); /* FIXME: e.g., wav audio file */ dmap_structure_add (mlit, DMAP_CC_ASDT, ""); /* FIXME: e.g., wav audio file */
......
...@@ -363,8 +363,11 @@ add_entry_to_mlcl (gpointer id, ...@@ -363,8 +363,11 @@ add_entry_to_mlcl (gpointer id,
if (_dmap_share_client_requested (mb->bits, ITEM_NAME)) { if (_dmap_share_client_requested (mb->bits, ITEM_NAME)) {
gchar *filename; gchar *filename;
g_object_get (record, "filename", &filename, NULL); g_object_get (record, "filename", &filename, NULL);
dmap_structure_add (mlit, DMAP_CC_MINM, filename); if (filename) {
g_free (filename); dmap_structure_add (mlit, DMAP_CC_MINM, filename);
g_free (filename);
} else
g_warning ("Filename requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, PERSISTENT_ID)) if (_dmap_share_client_requested (mb->bits, PERSISTENT_ID))
dmap_structure_add (mlit, DMAP_CC_MPER, GPOINTER_TO_UINT (id)); dmap_structure_add (mlit, DMAP_CC_MPER, GPOINTER_TO_UINT (id));
...@@ -373,8 +376,11 @@ add_entry_to_mlcl (gpointer id, ...@@ -373,8 +376,11 @@ add_entry_to_mlcl (gpointer id,
* and this does seem to be the case when testing. */ * and this does seem to be the case when testing. */
gchar *aspect_ratio; gchar *aspect_ratio;
g_object_get (record, "aspect-ratio", &aspect_ratio, NULL); g_object_get (record, "aspect-ratio", &aspect_ratio, NULL);
dmap_structure_add (mlit, DMAP_CC_PASP, aspect_ratio); if (aspect_ratio) {
g_free (aspect_ratio); dmap_structure_add (mlit, DMAP_CC_PASP, aspect_ratio);
g_free (aspect_ratio);
} else
g_warning ("Aspect ratio requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, PHOTO_CREATIONDATE)) { if (_dmap_share_client_requested (mb->bits, PHOTO_CREATIONDATE)) {
gint creation_date; gint creation_date;
...@@ -384,14 +390,20 @@ add_entry_to_mlcl (gpointer id, ...@@ -384,14 +390,20 @@ add_entry_to_mlcl (gpointer id,
if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILENAME)) { if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILENAME)) {
gchar *filename; gchar *filename;
g_object_get (record, "filename", &filename, NULL); g_object_get (record, "filename", &filename, NULL);
dmap_structure_add (mlit, DMAP_CC_PIMF, filename); if (filename) {
g_free (filename); dmap_structure_add (mlit, DMAP_CC_PIMF, filename);
g_free (filename);
} else
g_warning ("Filename requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFORMAT)) { if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFORMAT)) {
gchar *format; gchar *format;
g_object_get (record, "format", &format, NULL); g_object_get (record, "format", &format, NULL);
dmap_structure_add (mlit, DMAP_CC_PFMT, format); if (format) {
g_free (format); dmap_structure_add (mlit, DMAP_CC_PFMT, format);
g_free (format);
} else
g_warning ("Format requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILESIZE)) { if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILESIZE)) {
gint filesize; gint filesize;
...@@ -421,8 +433,11 @@ add_entry_to_mlcl (gpointer id, ...@@ -421,8 +433,11 @@ add_entry_to_mlcl (gpointer id,
if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGECOMMENTS)) { if (_dmap_share_client_requested (mb->bits, PHOTO_IMAGECOMMENTS)) {
gchar *comments; gchar *comments;
g_object_get (record, "comments", &comments, NULL); g_object_get (record, "comments", &comments, NULL);
dmap_structure_add (mlit, DMAP_CC_PCMT, comments); if (comments) {
g_free (comments); dmap_structure_add (mlit, DMAP_CC_PCMT, comments);
g_free (comments);
} else
g_warning ("Comments requested but not available");
} }
if (_dmap_share_client_requested (mb->bits, PHOTO_FILEDATA)) { if (_dmap_share_client_requested (mb->bits, PHOTO_FILEDATA)) {
size_t size = 0; size_t size = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment