mirror of
https://github.com/morgan9e/dash-to-panel
synced 2026-04-14 00:04:17 +09:00
Do not try to search undefined array
This commit is contained in:
14
utils.js
14
utils.js
@@ -240,13 +240,15 @@ var getAppDisplayViews = function() {
|
||||
};
|
||||
|
||||
var findIndex = function(array, predicate) {
|
||||
if (Array.prototype.findIndex) {
|
||||
return array.findIndex(predicate);
|
||||
}
|
||||
if (array) {
|
||||
if (Array.prototype.findIndex) {
|
||||
return array.findIndex(predicate);
|
||||
}
|
||||
|
||||
for (let i = 0, l = array.length; i < l; ++i) {
|
||||
if (predicate(array[i])) {
|
||||
return i;
|
||||
for (let i = 0, l = array.length; i < l; ++i) {
|
||||
if (predicate(array[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user