Skip to content

Commit

Permalink
Guard -1 index for ensemblesVectorListHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenherje committed Dec 5, 2023
1 parent c615f86 commit 8d9e9cf
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class EnsembleVectorListsHelper {
isVectorInEnsemble(ensemble: EnsembleIdent, vector: string): boolean {
const index = this._ensembleIdents.indexOf(ensemble);

if (!this._queries[index].data) return false;
if (index === -1 || !this._queries[index].data) return false;

return this._queries[index].data?.some((vec) => vec.name === vector) ?? false;
}
Expand All @@ -69,6 +69,7 @@ export class EnsembleVectorListsHelper {
if (!this.isVectorInEnsemble(ensemble, vector)) return false;

const index = this._ensembleIdents.indexOf(ensemble);
if (index === -1 || !this._queries[index].data) return false;

return this._queries[index].data?.some((vec) => vec.name === vector && vec.has_historical) ?? false;
}
Expand Down

0 comments on commit 8d9e9cf

Please sign in to comment.