1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Catch a file error when saving recent scans. Fixes #1177

This commit is contained in:
dmiller
2018-04-09 16:17:09 +00:00
parent aa1a94db53
commit f45da78f5b

View File

@@ -767,9 +767,18 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
scan_interface.saved_filename = directory
# Saving recent scan information
for filename in filenames:
recent_scans.add_recent_scan(filename)
recent_scans.save()
try:
for filename in filenames:
recent_scans.add_recent_scan(filename)
recent_scans.save()
except (OSError, IOError), e:
alert = HIGAlertDialog(
message_format=_(
"Can't save recent scan information"),
secondary_text=_(
"Can't open file to write.\n%s") % str(e))
alert.run()
alert.destroy()
def _save(self, scan_interface, saved_filename, selected_index,
format="xml"):
@@ -794,8 +803,17 @@ This scan has not been run yet. Start the scan with the "Scan" button first.'))
if format == "xml":
# Saving recent scan information
recent_scans.add_recent_scan(saved_filename)
recent_scans.save()
try:
recent_scans.add_recent_scan(saved_filename)
recent_scans.save()
except (OSError, IOError), e:
alert = HIGAlertDialog(
message_format=_(
"Can't save recent scan information"),
secondary_text=_(
"Can't open file to write.\n%s") % str(e))
alert.run()
alert.destroy()
def get_empty_interface(self):
"""Return this window if it is empty, otherwise create and return a new