diff --git a/server/camlistored/ui/blob_item_container_react.js b/server/camlistored/ui/blob_item_container_react.js index e5c1ef1ab..32763ac8d 100644 --- a/server/camlistored/ui/blob_item_container_react.js +++ b/server/camlistored/ui/blob_item_container_react.js @@ -136,6 +136,9 @@ cam.BlobItemContainerReact = React.createClass({ this.childProps_ = []; var results = this.props.searchSession.getCurrentResults(); + if (!results || !results.blobs || results.blobs.length == 0) { + return; + } var data = goog.array.map(results.blobs, function(blob) { return new cam.BlobItemReactData(blob.blob, results.description.meta); }); diff --git a/server/camlistored/ui/search_session.js b/server/camlistored/ui/search_session.js index fdd47446e..a8be4270f 100644 --- a/server/camlistored/ui/search_session.js +++ b/server/camlistored/ui/search_session.js @@ -178,7 +178,11 @@ cam.SearchSession.prototype.startSocketQuery_ = function() { this.socket_.close(); } - var query = this.connection_.buildQuery(this.query_, this.constructor.DESCRIBE_REQUEST, Math.max(this.data_.blobs.length, this.constructor.PAGE_SIZE_)); + var numResults = 0; + if (this.data_ && this.data_.blobs) { + numResults = this.data_.blobs.length; + } + var query = this.connection_.buildQuery(this.query_, this.constructor.DESCRIBE_REQUEST, Math.max(numResults, this.constructor.PAGE_SIZE_)); this.socket_ = new WebSocket(this.socketUri_.toString()); this.socket_.onopen = function() {