mirror of https://github.com/perkeep/perkeep.git
Merge "ui: check for non nil results before using them"
This commit is contained in:
commit
52a68b9c30
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue