Skip to content

Build your personal knowledge base with Trilium Notes

fix(note_icon): crash when reducing number of items

Elian Doranbecf4d742610
diff --git a/apps/client/src/widgets/note_icon.tsx b/apps/client/src/widgets/note_icon.tsx
index 76d8cbed09..70d79fb657 100644
--- a/apps/client/src/widgets/note_icon.tsx
+++ b/apps/client/src/widgets/note_icon.tsx
@@ -155,7 +155,9 @@ function IconItemCell({ rowIndex, columnIndex, style, filteredIcons }: CellCompo
filteredIcons: IconWithName[];
}>): React.JSX.Element {
const iconIndex = rowIndex * 12 + columnIndex;
- const iconData = filteredIcons[iconIndex];
+ const iconData = filteredIcons[iconIndex] as IconWithName | undefined;
+ if (!iconData) return <span style={style as CSSProperties} />;
+
const { id, terms, iconPack } = iconData;
return (
<span