layerNr = self.layerSelect.getValue()
if layerNr == self.layerSelect.getMaxValue() and result is not None and len(result._polygons) > 0:
layerNr = max(layerNr, len(result._polygons))
- if len(result._polygons) > layerNr-1 and 'inset0' in result._polygons[layerNr-1] and len(result._polygons[layerNr-1]['inset0']) > 0 and len(result._polygons[layerNr-1]['inset0'][0]) > 0:
+ if result is not None and len(result._polygons) > layerNr-1 and 'inset0' in result._polygons[layerNr-1] and len(result._polygons[layerNr-1]['inset0']) > 0 and len(result._polygons[layerNr-1]['inset0'][0]) > 0:
viewZ = result._polygons[layerNr-1]['inset0'][0][0][2]
else:
viewZ = (layerNr - 1) * profile.getProfileSettingFloat('layer_height') + profile.getProfileSettingFloat('bottom_thickness')