[gnome-maps/gnome-3-38] mapView: Don't try to set aerial tiles if not available



commit 53f9fb6ebfa215e1869d9ffa346afcc1c3eacb65
Author: Marcus Lundblad <ml update uu se>
Date:   Thu May 27 23:12:34 2021 +0200

    mapView: Don't try to set aerial tiles if not available
    
    Safe-guard agains setting the aerial tile source
    if it's not available in the service file.
    This avoid a crash if aerial was saved as last-used
    map type in gsettings and at next startup the service
    has dropped support.

 src/mapView.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index 94f06d3b..a352d23b 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -413,15 +413,17 @@ var MapView = GObject.registerClass({
         this._mapType = mapType;
 
         if (mapType !== MapType.LOCAL) {
-            if (mapType === MapType.AERIAL) {
-                if (Service.getService().tiles.hybridAerial &&
+            let tiles = Service.getService().tiles;
+
+            if (mapType === MapType.AERIAL && tiles.aerial) {
+                if (tiles.hybridAerial &&
                     Application.settings.get('hybrid-aerial')) {
                     this.view.map_source = MapSource.createHybridAerialSource();
                 } else {
                     this.view.map_source = MapSource.createAerialSource();
                 }
             } else {
-                if (Service.getService().tiles.streetDark &&
+                if (tiles.streetDark &&
                     Application.settings.get('night-mode')) {
                     this.view.map_source = MapSource.createStreetDarkSource();
                 } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]