AttributeError: 'NoneType' object has no attribute 'buffer_id'
Sometimes during startup I get this exception:

```
Traceback (most recent call last):
  File "/home/code/sublime_text_3/sublime_plugin.py", line 594, in on_selection_modified_async
    callback.on_selection_modified_async(v)
  File "/home/code/.config/sublime-text-3/Packages/SublimeLinter/highlight_view.py", line 247, in on_selection_modified_async
    if view.buffer_id() == active_view.buffer_id():
AttributeError: 'NoneType' object has no attribute 'buffer_id'
```

I looked into it a little and found that the `State['active_view']` doesn't have the active view in `"/home/code/.config/sublime-text-3/Packages/SublimeLinter/highlight_view.py", line 247`. I couldn't figure out why. It happens ~35% of the time.


diff --git a/busy_indicator_view.py b/busy_indicator_view.py
index 05481f7..a79ecd0 100644
--- a/busy_indicator_view.py
+++ b/busy_indicator_view.py
@@ -36,7 +36,7 @@ def on_begin_linting(buffer_id):
     State['running'][buffer_id] = time.time()
 
     active_view = State['active_view']
-    if active_view.buffer_id() == buffer_id:
+    if active_view and active_view.buffer_id() == buffer_id:
         sublime.set_timeout_async(lambda: draw(**State), INITIAL_DELAY * 1000)
 
 
@@ -45,7 +45,7 @@ def on_finished_linting(buffer_id, **kwargs):
     State['running'].pop(buffer_id, None)
 
     active_view = State['active_view']
-    if active_view.buffer_id() == buffer_id:
+    if active_view and active_view.buffer_id() == buffer_id:
         draw(**State)
 
 
diff --git a/goto_commands.py b/goto_commands.py
index 6270107..e4c0fa7 100644
--- a/goto_commands.py
+++ b/goto_commands.py
@@ -13,7 +13,9 @@ Implement typical Goto Next Previous Error Commands.
 
 class SublimeLinterGotoError(sublime_plugin.WindowCommand):
     def run(self, direction='next', count=1, wrap=False):
-        goto(self.window.active_view(), direction, count, wrap)
+        active_view = self.window.active_view()
+        if active_view:
+            goto(active_view, direction, count, wrap)
 
 
 def goto(view, direction, count, wrap):
diff --git a/highlight_view.py b/highlight_view.py
index c87d145..e157277 100644
--- a/highlight_view.py
+++ b/highlight_view.py
@@ -234,6 +234,10 @@ class IdleViewController(sublime_plugin.EventListener):
 
     def on_selection_modified_async(self, view):
         active_view = State['active_view']
+        # Do not race between `plugin_loaded` and this event handler
+        if active_view is None:
+            return
+
         time_to_idle = persist.settings.get('highlights.time_to_idle')
         if view.buffer_id() == active_view.buffer_id():
             queue.debounce(
@@ -275,6 +279,9 @@ def toggle_demoted_regions(view, show):
 class SublimeLinterToggleHighlights(sublime_plugin.WindowCommand):
     def run(self):
         view = self.window.active_view()
+        if not view:
+            return
+
         vid = view.id()
         hidden = vid in State['quiet_views']
         if hidden:
@@ -621,8 +628,11 @@ class TooltipController(sublime_plugin.EventListener):
 class SublimeLinterLineReportCommand(sublime_plugin.WindowCommand):
     def run(self):
         view = self.window.active_view()
+        if not view:
+            return
+
         point = view.sel()[0].begin()
-        open_tooltip(self.window.active_view(), point, line_report=True)
+        open_tooltip(view, point, line_report=True)
 
 
 TOOLTIP_STYLES = '''
diff --git a/status_bar_view.py b/status_bar_view.py
index 33f8723..48fb44d 100644
--- a/status_bar_view.py
+++ b/status_bar_view.py
@@ -31,7 +31,7 @@ def plugin_unloaded():
 @events.on(events.LINT_RESULT)
 def on_lint_result(buffer_id, **kwargs):
     active_view = State['active_view']
-    if active_view.buffer_id() == buffer_id:
+    if active_view and active_view.buffer_id() == buffer_id:
         draw(**State)
 
 
@@ -51,7 +51,7 @@ class UpdateState(sublime_plugin.EventListener):
         active_view = State['active_view']
         # It is possible that views (e.g. panels) update in the background.
         # So we check here and return early.
-        if active_view.buffer_id() != view.buffer_id():
+        if not active_view or active_view.buffer_id() != view.buffer_id():
             return
 
         current_pos = get_current_pos(active_view)
diff --git a/sublime_linter.py b/sublime_linter.py
index e0314ac..b7aa5d0 100644
--- a/sublime_linter.py
+++ b/sublime_linter.py
@@ -51,7 +51,8 @@ def plugin_loaded():
     # Lint the visible views from the active window on startup
     if persist.settings.get("lint_mode") in ("background", "load_save"):
         for view in visible_views():
-            hit(view)
+            if util.is_lintable(view):
+                hit(view)
 
 
 def plugin_unloaded():
@@ -102,7 +103,8 @@ def visible_views():
 
     # Priority for the active view
     active_view = window.active_view()
-    yield active_view
+    if active_view:
+        yield active_view
 
     num_groups = window.num_groups()
     for group_id in range(num_groups):
['sublime_linter.py', 'highlight_view.py', 'goto_commands.py', 'busy_indicator_view.py', 'status_bar_view.py']