From d735ac4807b556e3444ed9611691e44b00ddd915 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 17 Mar 2010 17:14:08 +0000 Subject: [PATCH] model: Let get_n_columns() return a sane value If you call get_n_columns() during the instance initialization phase but before set_name()/set_types() have been called, you'll get a (guint) -1. This is less than ideal. If columns haven't been initialized we should just return 0, which was the intent of the API since the beginning. Based on a patch by: Bastian Winkler Signed-off-by: Emmanuele Bassi --- clutter/clutter-model.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clutter/clutter-model.c b/clutter/clutter-model.c index 2b19542..5a982ea 100644 --- a/clutter/clutter-model.c +++ b/clutter/clutter-model.c @@ -244,7 +244,12 @@ clutter_model_real_get_column_name (ClutterModel *model, static guint clutter_model_real_get_n_columns (ClutterModel *model) { - return model->priv->n_columns; + ClutterModelPrivate *priv = model->priv; + + if (priv->n_columns < 0) + return 0; + + return priv->n_columns; } static void -- 2.7.4