Fix source (type)) lost on redownload: again
authorNiki Roo <niki@nikiroo.be>
Sun, 26 Nov 2017 15:37:08 +0000 (16:37 +0100)
committerNiki Roo <niki@nikiroo.be>
Sun, 26 Nov 2017 15:37:08 +0000 (16:37 +0100)
src/be/nikiroo/fanfix/library/CacheLibrary.java

index 38fb7b3193e1b13da59e2abc285d2a6bd0461dfa..d653332a73673aaff0bbce6b0128cb901c15b94b 100644 (file)
@@ -153,7 +153,9 @@ public class CacheLibrary extends BasicLibrary {
                pg.addProgress(pgCache, 1);
                pg.addProgress(pgOrig, 1);
 
-               cacheLib.changeSource(luid, newSource, pgCache);
+               if (isCached(luid)) {
+                       cacheLib.changeSource(luid, newSource, pgCache);
+               }
                pgCache.done();
                lib.changeSource(luid, newSource, pgOrig);
                pgOrig.done();
@@ -184,8 +186,10 @@ public class CacheLibrary extends BasicLibrary {
         *             in case of I/O error
         */
        public void clearFromCache(String luid) throws IOException {
-               cacheLib.delete(luid);
-               clearCache();
+               if (isCached(luid)) {
+                       cacheLib.delete(luid);
+                       clearCache();
+               }
        }
 
        // All the following methods are only used by Save and Delete in