From 8bd71e7179418925150ab9afc931868f25e20b80 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Wed, 20 Feb 2013 07:30:14 -0800 Subject: Made running updates safer and less likely to crash on startup --- .../src/github/daneren2005/dsub/updates/Updater.java | 10 +++++++++- .../src/github/daneren2005/dsub/updates/Updater373.java | 7 +++++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'subsonic-android/src') diff --git a/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java b/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java index a62920b9..69cdb642 100644 --- a/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java +++ b/subsonic-android/src/github/daneren2005/dsub/updates/Updater.java @@ -60,10 +60,18 @@ public class Updater { } } + public String getName() { + return this.TAG; + } + private class BackgroundUpdate extends AsyncTask { @Override protected Void doInBackground(Updater... params) { - params[0].update(context); + try { + params[0].update(context); + } catch(Exception e) { + Log.w(TAG, "Failed to run update for " + params[0].getName()); + } return null; } } diff --git a/subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java b/subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java index 4df31580..b56c2731 100644 --- a/subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java +++ b/subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java @@ -29,9 +29,10 @@ import java.io.File; * * @author Scott */ -public class Updater373 extends Updater { +public class Updater373 extends Updater { public Updater373() { super(373); + TAG = Updater373.class.getSimpleName(); } @Override @@ -39,7 +40,9 @@ public class Updater373 extends Updater { // Rename cover.jpeg to cover.jpg Log.i(TAG, "Running Updater373: updating cover.jpeg to cover.jpg"); File dir = FileUtil.getMusicDirectory(context); - moveArt(dir); + if(dir != null) { + moveArt(dir); + } } private void moveArt(File dir) { -- cgit v1.2.3