(MapCanvas.FitMapToWindow): This may be called during startup before a map has been created. Check if map is None before using it and do nothing if it is.