]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5375 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Aug 2022 15:07:28 +0000 (17:07 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Aug 2022 15:07:28 +0000 (17:07 +0200)
resources/scorm/scorm.js

index f1092484ac3e5c9744c48a25d520665917ac9fc0..e236a6208d16763ef8399cc5aa7ac0ab8faae75c 100644 (file)
@@ -144,8 +144,13 @@ window.getScormLocation = function (defaultLocation) {
 
     if (currentLocation.indexOf('[') === -1 && currentLocation.indexOf('{') === -1) {
         // Maybe a zipped string
-        currentLocation = pako.inflate(base64ToBytesArr(currentLocation), {to: 'string'})
-        console.log(currentLocation);
+        try {
+            currentLocation = pako.inflate(base64ToBytesArr(currentLocation), {to: 'string'})
+            console.log(currentLocation);
+        } catch (e) {
+            console.warn('Unable to uncompress the data');
+            currentLocation = '';
+        }
     }
     if (currentLocation === undefined || currentLocation === null || currentLocation === 'null' || currentLocation === '') {
         res = defaultLocation;
@@ -159,7 +164,7 @@ window.getScormLocation = function (defaultLocation) {
         }
     }
 
-    if (res === undefined || res === null || res === 'null') {
+    if (res === undefined || res === null || res === 'null' || res === '') {
         res = defaultLocation;
     }
     return res;