Bläddra i källkod

[spark] Fix issue when there are not images in the result

This fixes an issue that occurs when the result does not have the image attribute defined.
Johan Ahlen 10 år sedan
förälder
incheckning
699eb659af
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      apps/spark/src/spark/static/spark/js/spark.ko.js

+ 2 - 1
apps/spark/src/spark/static/spark/js/spark.ko.js

@@ -99,6 +99,7 @@ var Result = function (snippet, result) {
     });
     self.fetchedOnce(false);
     self.data.removeAll();
+    self.images.removeAll();
     self.logs('');
     self.startTime(new Date());
     self.endTime(new Date());
@@ -427,7 +428,7 @@ var Snippet = function (vm, notebook, snippet) {
           _tempData.push(row);
         });
 
-        self.result.images(data.result.images);
+        self.result.images(typeof data.result.images != "undefined" && data.result.images != null ? data.result.images : []);
 
         $(document).trigger("renderData", {data: _tempData, snippet: self, initial: _initialIndex == 0});