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(permission): use optional chaining for command params (#6161)

WEI ZHANGebe1149f4b75
diff --git a/packages/sheets/src/controllers/permission/sheet-permission-check.controller.ts b/packages/sheets/src/controllers/permission/sheet-permission-check.controller.ts
index 077e459316..0d330c18bd 100644
--- a/packages/sheets/src/controllers/permission/sheet-permission-check.controller.ts
+++ b/packages/sheets/src/controllers/permission/sheet-permission-check.controller.ts
@@ -107,9 +107,9 @@ export class SheetPermissionCheckController extends Disposable {
rangeTypes: [RangeProtectionPermissionEditPoint],
worksheetTypes: [WorksheetSetCellValuePermission, WorksheetEditPermission],
},
- (params as IClearSelectionContentCommandParams).ranges,
- (params as IClearSelectionContentCommandParams).unitId,
- (params as IClearSelectionContentCommandParams).subUnitId
+ (params as IClearSelectionContentCommandParams)?.ranges,
+ (params as IClearSelectionContentCommandParams)?.unitId,
+ (params as IClearSelectionContentCommandParams)?.subUnitId
);
errorMsg = this._localeService.t('permission.dialog.editErr');
break;