From 48eaffab0eec23c10dffc182204c51ce33c0bdf9 Mon Sep 17 00:00:00 2001 From: maikito26 Date: Sat, 24 Oct 2015 14:06:23 -0400 Subject: [PATCH] Check if data exists before executing commands that would fail otherwise --- addon.xml | 2 +- changelog.txt | 5 +++++ resources/lib/utils.py | 15 +++++++++------ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/addon.xml b/addon.xml index 485c8ee..cb5f44d 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index 92608a3..df92bc2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +v1.0.3 (Oct 24 2015) +-------------------- +Fixed Issues: +- Further improved utils.py to check if data before executing commands + v1.0.2 (Oct 24 2015) -------------------- Fixed Issues: diff --git a/resources/lib/utils.py b/resources/lib/utils.py index a8e6da1..483eff9 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -85,14 +85,17 @@ def remove_cached_art(art): #Get cached image name to remove db.execute("SELECT cachedurl FROM texture WHERE url = '%s';" %art) data = db.fetchone() - #log(4, 'Removing Cached Art :: SQL Output: %s' %data[0]) -> Causes an error on first time configuring - file_to_delete = os.path.join(_tbn_path, data[0]) - log(4, 'Removing Cached Art :: File to be removed: %s' %file_to_delete) + if data[0]: + + log(4, 'Removing Cached Art :: SQL Output: %s' %data[0]) -> Causes an error on first time configuring + + file_to_delete = os.path.join(_tbn_path, data[0]) + log(4, 'Removing Cached Art :: File to be removed: %s' %file_to_delete) - xbmcvfs.delete(file_to_delete) - db.execute("DELETE FROM texture WHERE url = '%s';" %art) - + xbmcvfs.delete(file_to_delete) + db.execute("DELETE FROM texture WHERE url = '%s';" %art) + except lite.Error, e: print "Error %s:" % e.args[0] #sys.exit(1)