Ver Fonte

Added early return for when no mainOps exists

Taichi Masuyama há 4 anos atrás
pai
commit
c3004706c1
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      packages/app/src/server/service/page-operation.ts

+ 5 - 0
packages/app/src/server/service/page-operation.ts

@@ -26,6 +26,11 @@ class PageOperationService {
    */
   async canOperate(isRecursively: boolean, fromPathToOp: string | null, toPathToOp: string | null): Promise<boolean> {
     const mainOps = await PageOperation.findMainOps();
+
+    if (mainOps.length === 0) {
+      return true;
+    }
+
     const toPaths = mainOps.map(op => op.toPath).filter((p): p is string => p != null);
 
     if (isRecursively) {