fix #1830
diff --git a/mitmproxy/addons/view.py b/mitmproxy/addons/view.py
index b8b6093f5c..dd5b745dff 100644
--- a/mitmproxy/addons/view.py
+++ b/mitmproxy/addons/view.py
@@ -145,9 +145,9 @@ def store_count(self):
 
     def inbounds(self, index: int) -> bool:
         """
-            Is this index >= 0 and < len(self)
+            Is this 0 <= index < len(self)
         """
-        return index >= 0 and index < len(self)
+        return 0 <= index < len(self)
 
     def _rev(self, idx: int) -> int:
         """
@@ -359,7 +359,7 @@ def index(self) -> typing.Optional[int]:
             return self.view.index(self.flow)
 
     @index.setter
-    def index(self, idx) -> typing.Optional[int]:
+    def index(self, idx):
         if idx < 0 or idx > len(self.view) - 1:
             raise ValueError("Index out of view bounds")
         self.flow = self.view[idx]
diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py
index d7c312e5e6..fee215c610 100644
--- a/mitmproxy/tools/console/flowlist.py
+++ b/mitmproxy/tools/console/flowlist.py
@@ -355,9 +355,11 @@ def keypress(self, size, key):
         elif key == "e":
             self.master.toggle_eventlog()
         elif key == "g":
-            self.master.view.focus.index = 0
+            if len(self.master.view):
+                self.master.view.focus.index = 0
         elif key == "G":
-            self.master.view.focus.index = len(self.master.view) - 1
+            if len(self.master.view):
+                self.master.view.focus.index = len(self.master.view) - 1
         elif key == "f":
             signals.status_prompt.send(
                 prompt = "Filter View",
