From bcee2e21d47a758215a6e2a6806b0f2cd9dc1fea Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Wed, 30 Nov 2022 19:21:14 -0800 Subject: [PATCH] Fix NPE. --- .../src/components/import/FreemindImporter.ts | 1 - packages/web2d/src/components/Point.js | 14 ++++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/mindplot/src/components/import/FreemindImporter.ts b/packages/mindplot/src/components/import/FreemindImporter.ts index d5fd6c31..6967dc45 100644 --- a/packages/mindplot/src/components/import/FreemindImporter.ts +++ b/packages/mindplot/src/components/import/FreemindImporter.ts @@ -1,5 +1,4 @@ import xmlFormatter from 'xml-formatter'; -import { off } from 'process'; import Importer from './Importer'; import Mindmap from '../model/Mindmap'; import RelationshipModel from '../model/RelationshipModel'; diff --git a/packages/web2d/src/components/Point.js b/packages/web2d/src/components/Point.js index 7fe9da23..ab445ac0 100644 --- a/packages/web2d/src/components/Point.js +++ b/packages/web2d/src/components/Point.js @@ -41,14 +41,16 @@ class Point { } Point.fromString = function pointFromString(point) { - const values = point.split(','); let result = null; - if (values.lenght > 1) { - const x = Number.parseInt(values[0], 10); - const y = Number.parseInt(values[1], 10); + if (point) { + const values = point.split(','); + if (values.lenght > 1) { + const x = Number.parseInt(values[0], 10); + const y = Number.parseInt(values[1], 10); - if (!Number.isNaN(x) && !Number.isNaN(y)) { - result = new Point(x, y); + if (!Number.isNaN(x) && !Number.isNaN(y)) { + result = new Point(x, y); + } } } return result;