瀏覽代碼

[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 年之前
父節點
當前提交
699eb65
共有 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});