[libshumate] view: Impove input checks of shumate_view_go_to()
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] view: Impove input checks of shumate_view_go_to()
- Date: Fri, 5 Mar 2021 13:23:15 +0000 (UTC)
commit ce97254438a73333d9b8b52b4ea831acb7a7024c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Mar 5 07:40:24 2021 -0300
view: Impove input checks of shumate_view_go_to()
Instead of checking SHUMATE_IS_VIEW(view) twice in a row, do it only once
in the public function, and add sanity checks for the coordinates too.
shumate/shumate-view.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/shumate/shumate-view.c b/shumate/shumate-view.c
index b63e0e1..b0b2cb0 100644
--- a/shumate/shumate-view.c
+++ b/shumate/shumate-view.c
@@ -475,8 +475,6 @@ shumate_view_go_to_with_duration (ShumateView *view,
ShumateViewPrivate *priv = shumate_view_get_instance_private (view);
GoToContext *ctx;
- g_return_if_fail (SHUMATE_IS_VIEW (view));
-
if (duration_ms == 0)
{
shumate_view_center_on (view, latitude, longitude);
@@ -944,6 +942,8 @@ shumate_view_go_to (ShumateView *view,
guint duration;
g_return_if_fail (SHUMATE_IS_VIEW (view));
+ g_return_if_fail (latitude >= SHUMATE_MIN_LATITUDE && latitude <= SHUMATE_MAX_LATITUDE);
+ g_return_if_fail (longitude >= SHUMATE_MAX_LONGITUDE && longitude <= SHUMATE_MAX_LONGITUDE);
duration = priv->go_to_duration;
if (duration == 0) /* calculate duration from zoom level */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]