diff --git a/src/jlgraphic/app/JlGraphicApp.ts b/src/jlgraphic/app/JlGraphicApp.ts index 7dd0a46..c3cce44 100644 --- a/src/jlgraphic/app/JlGraphicApp.ts +++ b/src/jlgraphic/app/JlGraphicApp.ts @@ -537,13 +537,18 @@ export class GraphicApp extends EventEmitter { state.code, state.graphicType ); - if (!g) { - const template = this.getGraphicTemplatesByType(state.graphicType); - const g = template.new(); - g.loadState(state); - this.addGraphics(g); - } else if (g.updateStates(state)) { - g.repaint(); + try { + if (!g) { + const template = this.getGraphicTemplatesByType(state.graphicType); + const g = template.new(); + g.loadState(state); + this.addGraphics(g); + } else if (g.updateStates(state)) { + g.repaint(); + } + } catch (err) { + console.error('图形状态处理异常', g, state, err); + throw err; } }); }