Skip to content

Commit f39dfd4

Browse files
committed
fix: handle bad pitm
1 parent 6cd6fda commit f39dfd4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/isofile.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,12 @@ export class ISOFile<TSegmentUser = unknown, TSampleUser = unknown> {
21322132
}
21332133
}
21342134
if (meta.pitm) {
2135-
items[meta.pitm.item_id].primary = true;
2135+
const id = meta.pitm.item_id;
2136+
if (!items[id]) {
2137+
Log.warn('ISOFile', 'Primary item_id is: #' + id + ' which does not exist');
2138+
} else {
2139+
items[id].primary = true;
2140+
}
21362141
}
21372142
if (meta.iref) {
21382143
for (let i = 0; i < meta.iref.references.length; i++) {

0 commit comments

Comments
 (0)