diff options
author | Maximilian Hils <git@maximilianhils.com> | 2019-11-14 21:07:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-14 21:07:53 +0100 |
commit | d38e20689e053b2369e29790562a1e507f1ac9ef (patch) | |
tree | be7574383372b7f3e76054a588aefa082532e930 | |
parent | dac0bfe786a8d1dfdd97f29d6bb262ed258153fa (diff) | |
parent | 9a1ec6b0646e67a8d9332910efec35752d003561 (diff) | |
download | mitmproxy-d38e20689e053b2369e29790562a1e507f1ac9ef.tar.gz mitmproxy-d38e20689e053b2369e29790562a1e507f1ac9ef.tar.bz2 mitmproxy-d38e20689e053b2369e29790562a1e507f1ac9ef.zip |
Merge pull request #3698 from ylmrx/crash_on_empty_focus_next
Fixes crash upon view.focus.[next|prev] - #3694
-rw-r--r-- | mitmproxy/addons/view.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mitmproxy/addons/view.py b/mitmproxy/addons/view.py index 4224877a..da9d19f9 100644 --- a/mitmproxy/addons/view.py +++ b/mitmproxy/addons/view.py @@ -238,18 +238,24 @@ class View(collections.abc.Sequence): """ Set focus to the next flow. """ - idx = self.focus.index + 1 - if self.inbounds(idx): - self.focus.flow = self[idx] + if self.focus.index is not None: + idx = self.focus.index + 1 + if self.inbounds(idx): + self.focus.flow = self[idx] + else: + pass @command.command("view.focus.prev") def focus_prev(self) -> None: """ Set focus to the previous flow. """ - idx = self.focus.index - 1 - if self.inbounds(idx): - self.focus.flow = self[idx] + if self.focus.index is not None: + idx = self.focus.index - 1 + if self.inbounds(idx): + self.focus.flow = self[idx] + else: + pass # Order @command.command("view.order.options") |