[cairo] [PATCH v8 45/71] drm: some more assertions

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Thu Jun 30 15:46:23 UTC 2016


Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
 src/drm/cairo-drm-surface.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/drm/cairo-drm-surface.c b/src/drm/cairo-drm-surface.c
index 9c17a82..e11b480 100644
--- a/src/drm/cairo-drm-surface.c
+++ b/src/drm/cairo-drm-surface.c
@@ -373,7 +373,10 @@ cairo_drm_surface_unmap (cairo_surface_t *abstract_surface,
 cairo_surface_t *
 _cairo_drm_surface_map_to_image (void *abstract_surface)
 {
+    assert(abstract_surface != NULL);
     cairo_drm_surface_t *surface = _cairo_surface_cast_drm (abstract_surface);
+    assert(surface != NULL);
+
     if (surface->fallback == NULL) {
 	cairo_surface_t *image;
 	cairo_status_t status;
@@ -387,6 +390,8 @@ _cairo_drm_surface_map_to_image (void *abstract_surface)
 
 	cairo_drm_device_t * drm_dev = _cairo_device_cast_drm (surface->base.device);
 
+	assert (surface->bo != NULL);
+
 	ptr = drm_dev->bo.map (drm_dev, surface->bo);
 
 	if (unlikely (ptr == NULL))
@@ -540,6 +545,8 @@ _cairo_drm_surface_acquire_source_image (void *abstract_surface,
 
     if (drm_dev->bo.get_image == NULL)
     {
+	assert (surface->bo != NULL);
+
 	void *ptr = drm_dev->bo.map (drm_dev, surface->bo);
 
 	if (unlikely (ptr == NULL))
-- 
2.6.4.442.g545299f



More information about the cairo mailing list