Преглед изворни кода

[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});