Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: fix crash when `theme.colors` is undefined

Abdullah Attaf1d4fd1d5d5d
diff --git a/packages/editor/src/toolbar/components/icon.tsx b/packages/editor/src/toolbar/components/icon.tsx
index d5ab84d95..61d347f2c 100644
--- a/packages/editor/src/toolbar/components/icon.tsx
+++ b/packages/editor/src/toolbar/components/icon.tsx
@@ -27,6 +27,7 @@ function isSchemeColor(
color: string,
theme: Theme
): color is keyof SchemeColors {
+ if (!theme || !theme.colors) return false;
return color in theme.colors;
}