diff --git a/controls/pivotview/src/base/engine.ts b/controls/pivotview/src/base/engine.ts index 08212f375a..f61b91f98a 100644 --- a/controls/pivotview/src/base/engine.ts +++ b/controls/pivotview/src/base/engine.ts @@ -848,9 +848,11 @@ export class PivotEngine { lenE = lenE - 1; while (lenE > -1) { let index: number = this.fields.indexOf(this.excludeFields[lenE]); - this.fields.splice(index, 1); - if (this.fieldList) { - delete this.fieldList[this.excludeFields[lenE]]; + if (index > -1) { + this.fields.splice(index, 1); + if (this.fieldList) { + delete this.fieldList[this.excludeFields[lenE]]; + } } lenE--; } @@ -5707,4 +5709,4 @@ export interface FieldItemInfo { * Specifies the position of the field in the exis. */ position?: number; -} \ No newline at end of file +}