From be2e41391460327f77bf144d36e841c384497f4d Mon Sep 17 00:00:00 2001 From: david Date: Fri, 30 Mar 2012 07:17:50 +0000 Subject: [PATCH] Don't crash in the profile editor when script.db is missing. --- CHANGELOG | 4 ++++ zenmap/zenmapCore/ScriptMetadata.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 204f58e1c..3c7fc510c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Nmap Changelog ($Id$); -*-text-*- +o [Zenmap] Fixed a crash that would happen in the profile editor when + the script.db file doesn't exist. The bug was reported by Daniel + Miller. + o [Zenmap] It is now possible to compare scans having the same name or command line. [Jah, David Fifield] diff --git a/zenmap/zenmapCore/ScriptMetadata.py b/zenmap/zenmapCore/ScriptMetadata.py index 0d7ecb9e2..eed66c1d6 100755 --- a/zenmap/zenmapCore/ScriptMetadata.py +++ b/zenmap/zenmapCore/ScriptMetadata.py @@ -417,7 +417,10 @@ def get_script_entries(scripts_dir, nselib_dir): """Merge the information obtained so far into one single entry for each script and return it.""" metadata = ScriptMetadata(scripts_dir, nselib_dir) - scriptdb = ScriptDB(os.path.join(scripts_dir, "script.db")) + try: + scriptdb = ScriptDB(os.path.join(scripts_dir, "script.db")) + except IOError: + return [] entries = [] for dbentry in scriptdb.get_entries_list(): entry = metadata.get_metadata(dbentry["filename"])