--- gstadapter.c	2011-12-30 02:14:35.000000000 +0100
+++ allopez_gstadapter.c	2012-09-04 09:40:34.428342221 +0200
@@ -259,8 +259,14 @@
   while (G_UNLIKELY (skip >= bsize)) {
     skip -= bsize;
     g = g_slist_next (g);
-    buf = g->data;
-    bsize = GST_BUFFER_SIZE (buf);
+	
+	if(g)
+	{
+		buf = g->data;
+		bsize = GST_BUFFER_SIZE (buf);
+	}
+	else
+		break;   
   }
   /* copy partial buffer */
   csize = MIN (bsize - skip, size);
@@ -271,14 +277,20 @@
   /* second step, copy remainder */
   while (size > 0) {
     g = g_slist_next (g);
-    buf = g->data;
-    bsize = GST_BUFFER_SIZE (buf);
-    if (G_LIKELY (bsize > 0)) {
-      csize = MIN (bsize, size);
-      memcpy (dest, GST_BUFFER_DATA (buf), csize);
-      size -= csize;
-      dest += csize;
-    }
+	if(g)
+	{	
+		buf = g->data;
+		bsize = GST_BUFFER_SIZE (buf);
+		if (G_LIKELY (bsize > 0)) 
+		{
+			csize = MIN (bsize, size);
+	      		memcpy (dest, GST_BUFFER_DATA (buf), csize);
+	      		size -= csize;
+	      		dest += csize;
+		}
+	}
+	else 
+		break;	
   }
 }
 
