aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMemphiz <memphis@machzwo.de>2012-01-11 23:01:48 +0100
committerMemphiz <memphis@machzwo.de>2012-01-11 23:04:16 +0100
commitf3376f7349d09d9c127ae756af6017d5200a2d74 (patch)
tree9228fb719575b367445f80ba335a9c3e8bc150de /lib
parent9d17a479d46df83ae5c3e188942bae28ec0f902c (diff)
[id3tag] - lets be pedantic with the pointer checks in getcomment. This might fix subtle crashes on ios - and it should be done nevertheless
Diffstat (limited to 'lib')
-rw-r--r--lib/libid3tag/libid3tag/metadata.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/libid3tag/libid3tag/metadata.c b/lib/libid3tag/libid3tag/metadata.c
index 8f1337fe10..3b03a6a758 100644
--- a/lib/libid3tag/libid3tag/metadata.c
+++ b/lib/libid3tag/libid3tag/metadata.c
@@ -309,7 +309,11 @@ const id3_ucs4_t* id3_metadata_getcomment(const struct id3_tag* tag, enum id3_fi
if (frame && frame->nfields == 4)
{
//get short description
- ucs4 = id3_field_getstring(id3_frame_field(frame, 2));
+ field = id3_frame_field(frame, 2);
+ if (field == 0)
+ continue;
+
+ ucs4 = id3_field_getstring(field);
// Multiple values are allowed per comment field, but storing different comment
// frames requires a different description for each frame. The first COMM frame
@@ -318,7 +322,12 @@ const id3_ucs4_t* id3_metadata_getcomment(const struct id3_tag* tag, enum id3_fi
if (ucs4 && *ucs4 == 0)//if short description on this frame is empty - consider this the wanted comment frame
{
//fetch encoding of the frame
- *encoding = id3_field_gettextencoding(id3_frame_field(frame, 0));
+ field = id3_frame_field(frame, 0);
+
+ if(field == 0)
+ continue;
+
+ *encoding = id3_field_gettextencoding(field);
//finally fetch the comment
field = id3_frame_field(frame, 3);