Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(sheets-ui): guard getSheetObject null inputs (#7116)

wpxp1234560a3870289068
diff --git a/packages/sheets-ui/src/controllers/utils/component-tools.ts b/packages/sheets-ui/src/controllers/utils/component-tools.ts
index 4f361e6626..c80639e9b0 100644
--- a/packages/sheets-ui/src/controllers/utils/component-tools.ts
+++ b/packages/sheets-ui/src/controllers/utils/component-tools.ts
@@ -55,6 +55,8 @@ export function getSheetObject(
univerInstanceService: IUniverInstanceService | Workbook,
renderManagerService: IRenderManagerService | IRenderContext
): Nullable<ISheetObjectParam> {
+ if (!univerInstanceService || !renderManagerService) return null;
+
const workbook = univerInstanceService instanceof Workbook
? univerInstanceService
: univerInstanceService.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET);