Переглянути джерело

[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 роки тому
батько
коміт
699eb659af
1 змінених файлів з 2 додано та 1 видалено
  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});