summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Techet <techet@gmail.com>2010-05-16 14:57:08 +0200
committerJiří Techet <techet@gmail.com>2010-05-16 14:57:08 +0200
commit9348681ee0e9fde605c5044ee7ef223de5b0e904 (patch)
tree7c7685838bb26f649008b2cf878ddbea584ad6af
parent8eef345db2e8c1f38c88d792413b4eb362a4174a (diff)
downloadlibchamplain-9348681ee0e9fde605c5044ee7ef223de5b0e904.tar.gz
Check validity of the top left tile to be loaded
If it is outside the range, set it to the closest valid value. Prevents crash when map panned left on low zoom level. Signed-off-by: Jiří Techet <techet@gmail.com>
-rw-r--r--champlain/champlain-view.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 2084b91..2590e77 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -2410,15 +2410,16 @@ view_load_visible_tiles (ChamplainView *view)
max_y_end = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level);
if (x_end > max_x_end)
- {
- x_end = max_x_end;
- x_count = x_end - x_first;
- }
+ x_end = max_x_end;
if (y_end > max_y_end)
- {
- y_end = max_y_end;
- y_count = y_end - y_first;
- }
+ y_end = max_y_end;
+ if (x_first > max_x_end)
+ x_first = max_x_end;
+ if (y_first > max_y_end)
+ y_first = max_y_end;
+
+ x_count = x_end - x_first;
+ y_count = y_end - y_first;
DEBUG ("Range %d, %d to %d, %d", x_first, y_first, x_end, y_end);