nextgis / quickmapservices

QGIS plugin to find and add map services to a project in one click
http://plugins.qgis.org/plugins/quick_map_services/
GNU General Public License v2.0
170 stars 49 forks source link

QGIS 3.16 NoneType' object has no attribute 'nodeType' + fix #218

Closed ThomasHuxhorn closed 3 years ago

ThomasHuxhorn commented 3 years ago

Hi,

I made a new installation with QGIS 3.16.3 and Python 3.7.3. Install quickmapservice plugin, install contribution pack, try to add google or open streetmap layer and run into this error:

2021-02-24T10:48:20 WARNING Traceback (most recent call last): File "/home/kater/.local/share/QGIS/QGIS3/profiles/default/python/plugins/quick_map_services/quick_map_services.py", line 176, in insert_layer add_layer_to_map(ds) File "/home/kater/.local/share/QGIS/QGIS3/profiles/default/python/plugins/quick_map_services/qgis_map_helpers.py", line 148, in add_layer_to_map AttributeError: 'NoneType' object has no attribute 'nodeType'

The function iface.layerTreeView().currentNode() can return a NULL value / None Typ which is not checked. So I add this line bevor line 148 and not it works for me :)

if selected_node is not None:

I hope this helps Thomas

simgislab commented 3 years ago

see also https://github.com/nextgis/quickmapservices/issues/146

isostaticrbnd commented 3 years ago

Just ran into this issue with new download QGIS 3.16 on Windows 10:

AttributeError: 'NoneType' object has no attribute 'nodeType' Traceback (most recent call last): File "C:/Users/clark.catherine/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\quick_map_services\quick_map_services.py", line 176, in insert_layer add_layer_to_map(ds) File "C:/Users/clark.catherine/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\quick_map_services\qgis_map_helpers.py", line 148, in add_layer_to_map if selected_node.nodeType() == selected_node.NodeGroup: AttributeError: 'NoneType' object has no attribute 'nodeType'

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.16.7-Hannover Hannover, 0471743889

simgislab commented 3 years ago

did you install contrib pack?

514ckw4r3 commented 3 years ago

Fixed in 0.19.19