[cairo] [PATCH 42/71] drm: some more assertions

Enrico Weigelt, metux IT consult enrico.weigelt at gr13.net
Mon Apr 17 16:57:21 UTC 2017


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 9c17a82b1..e11b4801b 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.11.0.rc0.7.gbe5a750



More information about the cairo mailing list