diff --git a/pipi/codec/imlib.c b/pipi/codec/imlib.c
index 712df36..8083d52 100644
--- a/pipi/codec/imlib.c
+++ b/pipi/codec/imlib.c
@@ -38,6 +38,13 @@ pipi_image_t *pipi_load_imlib2(const char *name)
         return NULL;
 
     imlib_context_set_image(priv);
+
+    if(!imlib_image_get_data())
+    {
+        imlib_free_image();
+        return NULL;
+    }
+
     img = pipi_new(imlib_image_get_width(), imlib_image_get_height());
 
     img->p[PIPI_PIXELS_RGBA_C].pixels = imlib_image_get_data();