Guard against TypeError in diagrams

This commit is contained in:
yflory 2025-07-07 16:01:08 +02:00
parent ab7a0ce706
commit d60680584b

View File

@ -63,9 +63,11 @@ define([
var onDrawioInit = function() {
drawIoInitalized = true;
var readOnly = framework.isReadOnly() || framework.isLocked();
var grid = readOnly ? 0 : 1;
lastContent.mxfile.diagram.mxGraphModel._grid = grid;
if (lastContent?.mxfile?.diagram?.mxGraphModel) {
let readOnly = framework.isReadOnly() || framework.isLocked();
let grid = readOnly ? 0 : 1;
lastContent.mxfile.diagram.mxGraphModel._grid = grid;
}
var xmlStr = DiagramUtil.jsonContentAsXML(lastContent);
postMessageToDrawio({
action: 'load',