From: Pierre-Luc Beaudoin Date: Fri, 16 Oct 2009 20:42:21 +0000 (-0400) Subject: Don't allow invalid longitude and latitude X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=886d3f9bca7ee24b6f952f90aac3bf973a88dbd8;p=libchamplain Don't allow invalid longitude and latitude --- 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) {