diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-02-20 07:30:14 -0800 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-02-20 07:30:14 -0800 |
commit | 8bd71e7179418925150ab9afc931868f25e20b80 (patch) | |
tree | 71cfac0a8a43403f28dee88e35e880ee9d4e1ee3 | |
parent | e5e48a73998db6b4546e41e80f558cb4792176ab (diff) | |
download | dsub-8bd71e7179418925150ab9afc931868f25e20b80.tar.gz dsub-8bd71e7179418925150ab9afc931868f25e20b80.tar.bz2 dsub-8bd71e7179418925150ab9afc931868f25e20b80.zip |
Made running updates safer and less likely to crash on startup
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/updates/Updater.java | 10 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/updates/Updater373.java | 7 |
2 files changed, 14 insertions, 3 deletions
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<Updater, Void, Void> {
@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) {
|