Skip to content

Commit a0f7ddd

Browse files
committed
fix(studio): guard against null tag in timeline track style
getTrackStyle() can receive a falsy tag at runtime (e.g. empty string from timeline element defaults), causing toLowerCase() and startsWith() to throw. Default to "div" when tag is falsy.
1 parent f622e5a commit a0f7ddd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/studio/src/player/components/timelineIcons.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ const ICONS: Record<string, ReactNode> = {
3939
};
4040

4141
export function getTrackStyle(tag: string): TrackVisualStyle {
42-
const trackStyle = getTimelineTrackStyle(tag);
43-
const normalized = tag.toLowerCase();
42+
const safeTag = tag || "div";
43+
const trackStyle = getTimelineTrackStyle(safeTag);
44+
const normalized = safeTag.toLowerCase();
4445
const icon =
4546
normalized.startsWith("h") && normalized.length === 2 && "123456".includes(normalized[1] ?? "")
4647
? ICONS.h1

0 commit comments

Comments
 (0)