From ea137d35f3c778a2d00a773ae02b440c6683de74 Mon Sep 17 00:00:00 2001 From: Thomas James Alexander Thurman Date: Tue, 12 Dec 2006 18:30:27 +0000 Subject: [PATCH] Sanity check to avoid dereferencing a null pointer. * src/compositor.c (do_effect): Sanity check to avoid dereferencing a null pointer. --- ChangeLog | 5 +++++ src/compositor.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index ee20a5627..6730f3d37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-12-12 Thomas Thurman + + * src/compositor.c (do_effect): Sanity check to avoid dereferencing + a null pointer. + 2006-12-10 Thomas Thurman * configure.in: post-release bump to 2.17.5. diff --git a/src/compositor.c b/src/compositor.c index 05b4e1fb2..1b8ed6b0c 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -121,6 +121,15 @@ do_effect (MetaEffect *effect, MetaCompWindow *window; screen = meta_comp_screen_get_by_xwindow (get_xid (effect->window)); + + if (!screen) + { + /* sanity check: if no screen is found, bail */ + meta_warning ("No screen found for %s (%ld); aborting effect.\n", + effect->window->desc, get_xid (effect->window)); + return; + } + window = meta_comp_screen_lookup_window (screen, get_xid (effect->window)); switch (effect->type)