Type: Buggood first issue
Description
Describe the bug
When the multiSortMeta of the table is, for some reason, an empty array, the table tries to access an invalid index. This leads to unexpected behavior in our application.
TypeError: Cannot read properties of undefined (reading 'field')
at i.multisortField (http://localhost:4200/chunk-5KJFCQPK.js:3048:17941)
at http://localhost:4200/chunk-5KJFCQPK.js:3048:17680
at Array.sort (<anonymous>)
at i.sortMultiple (http://localhost:4200/chunk-5KJFCQPK.js:3048:17663)
at i.onChanges (http://localhost:4200/chunk-5KJFCQPK.js:3048:13126)
at i.ngOnChanges (http://localhost:4200/chunk-T7OEMV3O.js:156:9838)
at i.lA (http://localhost:4200/chunk-T7OEMV3O.js:4:18716)
at O_ (http://localhost:4200/chunk-T7OEMV3O.js:4:20279)
at fA (http://localhost:4200/chunk-T7OEMV3O.js:4:20434)
Pull Request Link
https://github.com/primefaces/primeng/pull/19573
Reproducer
https://stackblitz.com/edit/github-kfctoa6w?file=src%2Fapp%2Fapp.component.html
Environment
PrimeNG: 20.4.0 Angular: 20 Browsers: Firefox, Chromium based browsers
Angular version
20.3.19
PrimeNG version
v20
Node version
24.13.0
Browser(s)
No response
Steps to reproduce the behavior
Filling the [multiSortMeta] of the Table Component with an empty array leads to the console error.
Expected behavior
The table component should be able to handle an empty array instead of throwing errors.