From 381bf2fd234cc5874d914776437582c62575b42e Mon Sep 17 00:00:00 2001 From: jay Date: Wed, 4 Jun 2014 11:41:29 +0000 Subject: [PATCH] Correct a bug in the code for NmapOutputViewer.go_to_host that was put in revision 32936. The following steps caused the bug with the r32936 code: 1. Start a scan (say Quick Scan for simplicity) for a certain target (say A) 2. Wait for scan to complete 3. Start a scan for a different target (say B). 4. Wait for scan to complete 5. Click on host A in the Hosts list on the left (while scan B is still visible on the right) 6. BOOM! --- zenmap/zenmapGUI/NmapOutputViewer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zenmap/zenmapGUI/NmapOutputViewer.py b/zenmap/zenmapGUI/NmapOutputViewer.py index d1bf8b7d5..3bde8ab94 100644 --- a/zenmap/zenmapGUI/NmapOutputViewer.py +++ b/zenmap/zenmapGUI/NmapOutputViewer.py @@ -218,9 +218,13 @@ class NmapOutputViewer (gtk.VBox): buff = self.text_view.get_buffer() start_iter = buff.get_start_iter() - found = start_iter.forward_search( + found_tuple = start_iter.forward_search( "\nNmap scan report for %s\n" % host, gtk.TEXT_SEARCH_TEXT_ONLY - )[0] + ) + if found_tuple is None: + return + + found = found_tuple[0] if not found.forward_line(): return self.text_view.scroll_to_iter(found, 0, True, 0, 0)