mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-28 21:04:47 +00:00
Node.js: Fix MapModel rowData() calling map function even if the source model returned undefined
Also fix the function signature, which was wrong.
This commit is contained in:
parent
55a8f202ea
commit
2d6edfbd6c
2 changed files with 31 additions and 2 deletions
|
@ -502,8 +502,12 @@ export class MapModel<T, U> extends Model<U> {
|
|||
* @param row index in range 0..(rowCount() - 1).
|
||||
* @returns undefined if row is out of range otherwise the data.
|
||||
*/
|
||||
rowData(row: number): U {
|
||||
return this.#mapFunction(this.sourceModel.rowData(row));
|
||||
rowData(row: number): U | undefined {
|
||||
let data = this.sourceModel.rowData(row);
|
||||
if (data === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
return this.#mapFunction(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue