summaryrefslogtreecommitdiff
path: root/gtk/gtkcssmatcher.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-04-30 21:28:57 +0200
committerBenjamin Otte <otte@redhat.com>2012-05-01 03:13:02 +0200
commitb4195cb408ed59aa768423e382740f685cf15e60 (patch)
treec59939068dd2b93d70279a7d3c6ec9497428de20 /gtk/gtkcssmatcher.c
parent6c63842e689784447ada054c254546fbf326f5f9 (diff)
downloadgtk+-b4195cb408ed59aa768423e382740f685cf15e60.tar.gz
cssmatcher: Handle case of empty widget path
This is tested by the stylecontext test, but doesn't appear in practice.
Diffstat (limited to 'gtk/gtkcssmatcher.c')
-rw-r--r--gtk/gtkcssmatcher.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index e67c9eff71..c656ef48e7 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -187,16 +187,21 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
gtk_css_matcher_widget_path_has_position,
};
-void
+gboolean
_gtk_css_matcher_init (GtkCssMatcher *matcher,
const GtkWidgetPath *path,
GtkStateFlags state)
{
+ if (gtk_widget_path_length (path) == 0)
+ return FALSE;
+
matcher->path.klass = &GTK_CSS_MATCHER_WIDGET_PATH;
matcher->path.path = path;
matcher->path.state_flags = state;
matcher->path.index = gtk_widget_path_length (path) - 1;
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index);
+
+ return TRUE;
}
/* GTK_CSS_MATCHER_WIDGET_ANY */