[gegl/gsoc2009-gpu] GeglTile: check for the validity of the tile storage before fetching data from it



commit dba971e1040d48c33cf250db757a5a412e2060fb
Author: Jerson Michael Perpetua <jersonperpetua gmail com>
Date:   Wed Jul 15 22:59:14 2009 +0800

    GeglTile: check for the validity of the tile storage before fetching data from it
    
    Check for the validity of the tile storage (that is, check if it is NULL) before
    fetching data from it.

 gegl/buffer/gegl-tile.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index 0ade73b..a057658 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -270,19 +270,25 @@ gegl_tile_new (gint        width,
 Babl *
 gegl_tile_get_format (GeglTile *tile)
 {
-  return tile->tile_storage->format;
+  return (tile->tile_storage != NULL)
+           ? tile->tile_storage->format
+           : NULL;
 }
 
 gint
 gegl_tile_get_width (GeglTile *tile)
 {
-  return tile->tile_storage->tile_width;
+  return (tile->tile_storage != NULL)
+           ? tile->tile_storage->tile_width
+           : -1;
 }
 
 gint
 gegl_tile_get_height (GeglTile *tile)
 {
-  return tile->tile_storage->tile_height;
+  return (tile->tile_storage != NULL)
+           ? tile->tile_storage->tile_height
+           : -1;
 }
 
 guchar *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]