From 886d3f9bca7ee24b6f952f90aac3bf973a88dbd8 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Fri, 16 Oct 2009 16:42:21 -0400 Subject: [PATCH] Don't allow invalid longitude and latitude --- champlain/champlain-view.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c index cb6f3a7..d6ae74f 100644 --- a/champlain/champlain-view.c +++ b/champlain/champlain-view.c @@ -561,10 +561,12 @@ champlain_view_get_property (GObject *object, switch (prop_id) { case PROP_LONGITUDE: - g_value_set_double (value, priv->longitude); + g_value_set_double (value, + CLAMP (priv->longitude, CHAMPLAIN_MIN_LONG, CHAMPLAIN_MAX_LONG)); break; case PROP_LATITUDE: - g_value_set_double (value, priv->latitude); + g_value_set_double (value, + CLAMP (priv->latitude, CHAMPLAIN_MIN_LAT, CHAMPLAIN_MAX_LAT)); break; case PROP_ZOOM_LEVEL: g_value_set_int (value, priv->zoom_level); @@ -1399,8 +1401,8 @@ champlain_view_center_on (ChamplainView *view, gint x, y; ChamplainViewPrivate *priv = view->priv; - priv->longitude = longitude; - priv->latitude = latitude; + priv->longitude = CLAMP (longitude, CHAMPLAIN_MIN_LONG, CHAMPLAIN_MAX_LONG); + priv->latitude = CLAMP (latitude, CHAMPLAIN_MIN_LAT, CHAMPLAIN_MAX_LAT); if (!priv->map) { -- 2.39.5