This patch adds a null check before accessing the return value of
ds_subsurface_from_surface().
The return value of ds_subsurface_from_surface() can be null even though
the ds_surface_is_subsurface() returns true. That's the case when the
subsurface has been destroyed.
Change-Id: I40fd3910cd980d31823e8ba8fe3f4210fc52b515
static E_Subsurface *
_e_subsurface_from_surface(E_Surface *surface)
{
- if (!ds_surface_is_subsurface(surface->ds_surface))
+ struct ds_surface *ds_subsurface;
+
+ ds_subsurface = ds_subsurface_from_surface(surface->ds_surface);
+ if (!ds_subsurface)
return NULL;
- return _e_subsurface_from_ds_subsurface(
- ds_subsurface_from_surface(surface->ds_surface));
+ return _e_subsurface_from_ds_subsurface(ds_subsurface);
}
static E_Subsurface *