소스 검색

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 (