diff --git a/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts b/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts index 3c92fbdd38..9727667f3a 100644 --- a/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts +++ b/packages/ketcher-core/src/domain/entities/canvas-matrix/CanvasMatrix.ts @@ -201,7 +201,7 @@ export class CanvasMatrix { } const initialMatrixRowLength = - this.matrixConfig.initialMatrix.getRow(rowNumber).length; + this.matrixConfig.initialMatrix?.getRow(rowNumber)?.length || 0; if (columnNumber >= initialMatrixRowLength) { let emptyCellsAmount = this.initialMatrixWidth - columnNumber;