瀏覽代碼

136640 add null guard

soumaeda 2 年之前
父節點
當前提交
f39753cff1
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      packages/editor/src/components/CodeMirrorEditor/Toolbar/DiagramButton.tsx

+ 3 - 0
packages/editor/src/components/CodeMirrorEditor/Toolbar/DiagramButton.tsx

@@ -10,6 +10,9 @@ export const DiagramButton = (props: Props): JSX.Element => {
   const { editorKey } = props;
   const { open: openDrawioModal } = useDrawioModalForEditor();
   const onClickDiagramButton = useCallback(() => {
+    if (editorKey == null) {
+      return;
+    }
     openDrawioModal(editorKey);
   }, [editorKey, openDrawioModal]);
   return (