Merge pull request #3845 from fredj/collection_null_array

Prevent null array to be passed to an ol.Collection
This commit is contained in:
Frédéric Junod
2015-06-25 09:25:37 +02:00
2 changed files with 6 additions and 6 deletions

View File

@@ -79,7 +79,7 @@ ol.CollectionProperty = {
* @constructor
* @extends {ol.Object}
* @fires ol.CollectionEvent
* @param {Array.<T>=} opt_array Array.
* @param {!Array.<T>=} opt_array Array.
* @template T
* @api stable
*/
@@ -89,7 +89,7 @@ ol.Collection = function(opt_array) {
/**
* @private
* @type {Array.<T>}
* @type {!Array.<T>}
*/
this.array_ = goog.isDef(opt_array) ? opt_array : [];
@@ -113,7 +113,7 @@ ol.Collection.prototype.clear = function() {
/**
* Add elements to the collection. This pushes each item in the provided array
* to the end of the collection.
* @param {Array.<T>} arr Array.
* @param {!Array.<T>} arr Array.
* @return {ol.Collection.<T>} This collection.
* @api stable
*/
@@ -145,7 +145,7 @@ ol.Collection.prototype.forEach = function(f, opt_this) {
* is mutated, no events will be dispatched by the collection, and the
* collection's "length" property won't be in sync with the actual length
* of the array.
* @return {Array.<T>} Array.
* @return {!Array.<T>} Array.
* @api stable
*/
ol.Collection.prototype.getArray = function() {

View File

@@ -221,8 +221,8 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
var set = !add && !remove && !toggle;
var map = mapBrowserEvent.map;
var features = this.featureOverlay_.getSource().getFeaturesCollection();
var /** @type {Array.<ol.Feature>} */ deselected = [];
var /** @type {Array.<ol.Feature>} */ selected = [];
var /** @type {!Array.<ol.Feature>} */ deselected = [];
var /** @type {!Array.<ol.Feature>} */ selected = [];
var change = false;
if (set) {
// Replace the currently selected feature(s) with the feature(s) at the